On Nov 16, 9:45 pm, fly2279 <[email protected]> wrote: > Is there a way to zoom to fill all markers while keeping the center of > the map on a specific marker or LatLng?
Not built into the API - it's a pretty specialist function. In the years I've been working with various mapping APIs, I can't recall ever needing to do that. However, it's not that hard to do yourself. Conceptually, it'd be a matter of finding the furthest marker from your center point, then creating a LatLngBounds containing (1) that marker's coordinates and (2) another LatLng an equal distance in the opposite direction from the center. Then do a fitBounds on that. It gets a bit harder if your point set might span the antimeridian (the 180-degree longitude line, where it wraps around) or is at extremely high latitude (so Mercator distortion becomes significant. But most real-world data sets don't The thing to remember is that the API isn't magical; if it did have such a function this is exactly what it'd be doing internally. String -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=.
