Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [{
- "id": 1,
- "date": "1/1/2015",
- "Title": "Trinity College",
- "Latitude": 41.745167,
- "Longitude": -72.69263},
- {
- "id": 2,
- "date": "1/2/2015",
- "Title": "Wesleyan University",
- "Latitude": 41.55709,
- "Longitude": -72.65691
- },{...}]
- var markers = new L.markerClusterGroup(); //clustering function
- var markerList = [];
- for (var i = 0; i < jsonDataObject.length; i++) {
- var marker = L.marker(L.latLng(parseFloat(jsonDataObject[i].Latitude), parseFloat(jsonDataObject[i].Longitude)));
- marker.bindPopup(jsonDataObject[i].Title );
- markerList.push(marker);
- }
- markers.addLayers(markerList);
- map.addLayer(markers);
- marker.on('click', onClick_Marker)
- function onClick_Marker(e) {
- popup = L.popup()
- .setContent("The number id is: " + e.id)
- .openOn(map);
- }
- var Line1 = jsonDataObject[i].field1;
- var Line2 = jsonDataObject[i].field2;
- MCDs = L.marker([lat,lng]).bindPopup("<b>Address: </b>" + Line1 + "<br />State: " + Line2);
- mcd.addLayer(MCDs);
Add Comment
Please, Sign In to add comment