var size = 0; var ranges_line = [[99999.000000, 20079999.000000, [ new ol.style.Style({ stroke: new ol.style.Stroke({color: "rgba(247,251,255,1.0)", lineDash: null, width: 0}) })]], [20079999.000000, 40059999.000000, [ new ol.style.Style({ stroke: new ol.style.Stroke({color: "rgba(199,220,239,1.0)", lineDash: null, width: 0}) })]], [40059999.000000, 60039999.000000, [ new ol.style.Style({ stroke: new ol.style.Stroke({color: "rgba(114,178,215,1.0)", lineDash: null, width: 0}) })]], [60039999.000000, 80019999.000000, [ new ol.style.Style({ stroke: new ol.style.Stroke({color: "rgba(40,120,184,1.0)", lineDash: null, width: 0}) })]], [80019999.000000, 99999999.000000, [ new ol.style.Style({ stroke: new ol.style.Stroke({color: "rgba(8,48,107,1.0)", lineDash: null, width: 0}) })]]]; var styleCache_line={} var style_line = function(feature, resolution){ var value = feature.get("length"); var style = ranges_line[0][2]; for (i = 0; i < ranges_line.length; i++){ var range = ranges_line[i]; if (value > range[0] && value<=range[1]){ style = range[2]; } }; if ("") { var labelText = ""; } else { var labelText = "" } var key = value + "_" + labelText if (!styleCache_line[key]){ var text = new ol.style.Text({ font: '10.725px Calibri,sans-serif', text: labelText, textBaseline: "center", textAlign: "left", offsetX: 5, offsetY: 3, fill: new ol.style.Fill({ color: "rgba(0, 0, 0, 255)" }), }); styleCache_line[key] = new ol.style.Style({"text": text}) } var allStyles = [styleCache_line[key]]; allStyles.push.apply(allStyles, style); return allStyles; };