I accept points from the server and I want to create markers on my leaflet map.
I can do this as follows:
1) Get geojson with points and add to my map:
$.getJSON(dataurl, function(data) {
L.geoJson(data).addTo(map);
})
2) Get arrays of coordinates and add to my map:
$.getJSON(dataurl, function(points) {
var markers = L.featureGroup();
_.forEach(points, function (point) {
markers.push(L.marker(point.latlng, opts))
}
map.addLayer(markers);
})
I would like to find the answer to the following question: what is the difference between these approaches? Is there a performance gain using geojson?