-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set map bounds #138
Comments
does this sample help? |
Hi, Isn't that only for markers? I actually need to set the bounds to set of coordinates - though there will be no markers on the map for the coordinates. |
I've tested and confirmed that this only works on markers. If there is a way to do it with a polygon I can always just make a transparent polygon to do it with. |
Or, is there a way to toggle marker visibility but still have the fit to marker bounds work? Or should I just use a custom icon with a transparent 1x1 png for the bounds markers to mark each corner? |
Well, this actually doesn't work very well (the invisible marker method) because I have markers that exist slightly outside the bounds box - since the fit to bounds doesn't actually set the view port of the map to the same as the bounds box - it adds padding. |
This is what I'm looking for - the ability to define custom bounds to the map. var latlngbounds = new google.maps.LatLngBounds();
for (var i = 0; i < cwc2011_country_data.length; i++) {
for (var j = 0; j < cwc2011_country_data[i].latlngs.length; j++) {
latlngbounds.extend(cwc2011_country_data[i].latlngs[j]);
}
}
map.fitBounds(latlngbounds); |
I got around this by using the Google JS API calls instead of doing it through this control. This functionality would still be nice though. |
Is there a way to set the map bounds like you can in the Gmaps JS API? I have a set of bounds... can I set the map to use those instead of setting a static zoom level and center?
The text was updated successfully, but these errors were encountered: