Created
November 7, 2014 18:56
-
-
Save jdcauley/dafb0c6fef80005a1b14 to your computer and use it in GitHub Desktop.
leaflet.js
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
$.getJSON( url, function( data ) { | |
var factSites = data.feed.entry; | |
for(var i = 0; i < factSites.length; i++ ){ | |
var markerData = { | |
continent: factSites[i].gsx$continent.$t, | |
country: factSites[i].gsx$country.$t, | |
city: factSites[i].gsx$city.$t, | |
siteName: factSites[i].gsx$name.$t, | |
staff: factSites[i].gsx$totalstaff.$t, | |
structure: factSites[i].gsx$structureandfunding.$t, | |
active: factSites[i].gsx$active.$t, | |
url: factSites[i].gsx$url.$t, | |
lat: factSites[i].gsx$latitude.$t, | |
long: factSites[i].gsx$longitude.$t | |
}; | |
if(factSites[i].gsx$latitude.$t && factSites[i].gsx$longitude.$t){ | |
var newMarker = L.marker([factSites[i].gsx$latitude.$t, factSites[i].gsx$longitude.$t]); | |
newMarker.siteData = markerData; | |
newMarker.on('click', populateSidebar).addTo(map); | |
} | |
} | |
// var group = new L.FeatureGroup(site); | |
// map.addLayer(group); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment