Created
July 15, 2015 02:24
-
-
Save chriscalip/37df8bc7becbc8a10453 to your computer and use it in GitHub Desktop.
JS code snippet of geojson into leaflet layers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.each(marketAreas, function (key, marketArea) { | |
parsedMarketArea = { | |
'type': 'Feature', | |
'properties' : marketArea.properties, | |
'geometry' : jQuery.parseJSON(marketArea.geometry) | |
}; | |
maOverlayGroups[marketArea.properties.title] = L.geoJson(parsedMarketArea, { | |
'style': mapPolygonSettings, | |
'onEachFeature': function (feature, layer) { | |
var area_content = themeString( | |
area_theme, | |
'/node/' + feature.properties.nid, | |
feature.properties.title | |
); | |
layer.bindPopup(area_content, {className: 'map-popup'}); | |
} | |
}); | |
//maOverlayGroups[marketArea.properties.title] = new L.layerGroup().addTo(map); | |
maOverlays[marketArea.properties.title] = maOverlayGroups[marketArea.properties.title]; | |
}); | |
var controlMarketAreas, controlMarketAreasDiv; | |
L.control.layers(null, maOverlays, { | |
collapsed: true | |
}).addTo(map); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment