Skip to content

Instantly share code, notes, and snippets.

@SpencerCooley
Created February 25, 2013 02:07
Show Gist options
  • Save SpencerCooley/5026891 to your computer and use it in GitHub Desktop.
Save SpencerCooley/5026891 to your computer and use it in GitHub Desktop.
How to place an array of geojson features on a leaflet map.
//using leaflet.js
var theMap = L.map('the_map_div', {
center: whereYouWantToCenterYourMap,
layers: mapBoxLayer,
zoom: 11,
maxZoom: 18
});
var theFeaures = geoJsonObjectThatYouSentMe;
$.each(theLocations['features'], function(index, value){
L.geoJson(value).addTo(theMap)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment