var size = 0; var categories_polygon = {"big": [ new ol.style.Style({ stroke: new ol.style.Stroke({color: "rgba(0,0,0,1.0)", lineDash: null, width: 0}) , fill: new ol.style.Fill({color: "rgba(193,125,222,1.0)"}) })], "small": [ new ol.style.Style({ stroke: new ol.style.Stroke({color: "rgba(0,0,0,1.0)", lineDash: null, width: 0}) , fill: new ol.style.Fill({color: "rgba(116,202,176,1.0)"}) })], "": [ new ol.style.Style({ stroke: new ol.style.Stroke({color: "rgba(0,0,0,1.0)", lineDash: null, width: 0}) , fill: new ol.style.Fill({color: "rgba(202,165,77,1.0)"}) })]}; var styleCache_polygon={} var style_polygon = function(feature, resolution){ var value = feature.get("name"); var style = categories_polygon[value]; if ("") { var labelText = ""; } else { var labelText = "" } var key = value + "_" + labelText if (!styleCache_polygon[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_polygon[key] = new ol.style.Style({"text": text}) } var allStyles = [styleCache_polygon[key]]; allStyles.push.apply(allStyles, style); return allStyles; };