You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Joshua Plicque edited this page Mar 25, 2015
·
6 revisions
Adding markers
Here we cannot use handler.addMarkers(...) because we need to set an id on each of the marker. So we have to iterate over each marker, set the id, and add it to the map.
markers = ... // Fetch markers
Gmaps.store.markers = markers.map(function(m) {
marker = handler.addMarker(m);
marker.serviceObject.set('id', m.id); // You can add other attributes using set
return marker;
});
handler.bounds.extendWith(Gmaps.store.markers);
handler.fitMapToBounds();