Current release: 3.9.2
• For EE3 EE4 EE5 EE6 EE7
Maps - GeoJSON (dynamic colors)
ExpressionEngine Code
{exp:reinos_maps:html_header} {exp:reinos_maps:map fit_map:geojson="yes"} {maps:add_geojson} [{ "type": "Feature", "properties": {"party": "Republican"}, "geometry": { "type": "Polygon", "coordinates": [[ [-104.05, 48.99], [-97.22, 48.98], [-96.58, 45.94], [-104.03, 45.94], [-104.05, 48.99] ]] } }, { "type": "Feature", "properties": {"party": "Democrat"}, "geometry": { "type": "Polygon", "coordinates": [[ [-109.05, 41.00], [-102.06, 40.99], [-102.03, 36.99], [-109.04, 36.99], [-109.05, 41.00] ]] } }] {/maps:add_geojson} {/exp:reinos_maps:map} {exp:reinos_maps:html_footer} REINOS_MAPS.on('geojson.beforeReady', function(){ REINOS_MAPS.setGeoJsonStyle(function(feature) { switch (feature.properties.party) { case 'Republican': return {color: "#ff0000"}; case 'Democrat': return {color: "#0000ff"}; } }); });