API Charts for Google Maps
I have a collection of markers all showing in the correct place on my map. Then I use the following code to set the map borders so that all markers are visible.
bounds = new maps.LatLngBounds();
angular.forEach($scope.places, function(place) {
bounds.extend(new maps.LatLng(place.getLatitude(), place.getLongitude()));
});
console.log(bounds);
map.fitBounds(bounds);
console.log(map.getBounds());
However, the map ends in some random place where there are no markers at all. The console.log shows that the set of bounds does not quite match the bounds returned from getBounds ().
// var bounds;
j: 40.793571
k: 40.715086
va: ih
j: -74.00108699999998
k: -73.951866
and
// getBounds();
j: 40.828484316202136
k: 40.68011306824231
j: -74.09878523107909
k: -73.85416776892089
+3
source to share
No one has answered this question yet
See similar questions:
or similar: