Thursday, 7 September 2017

openlayers - How to define styles for features in JSON file


Styles for rendering features in OpenLayers 3 are defined as:


new ol.style.Style({
image: new ol.style.Circle({
radius: 6,
stroke: new ol.style.Stroke({
color: 'white',
width: 2
}),
fill: new ol.style.Fill({

color: 'green'
})
})
})

I would like to define my styles in JSON file, not in code. Is there any way how to load styles from JSON? I could easily load attributes like "color" : "green", but I cannot load something like new ol.style.Fill...




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...