Hi everyone,

I already asked this question on stackoverflow, but this is probably the 
better place to ask:

I am using Googles Map API v3. Can somebody explain the behavior of the 
map's bounding boxes to me?

Depending on the zoom level these bounds behave weird - when I zoom in it 
works as expected - the bounds stretch from the lower left corner of the 
pane to the upper right corner. As soon as I zoom out it get weirds - the 
bounding box splits up. You can reproduce this with the google examples and 
the attached code. Just zoom out until the maximum after running the code.

The wrong bounding boxes are really annoying - e.g. markers in between are 
not in the bounds of the map, although they are visible.

http://code.google.com/apis/maps/documentation/javascript/examples/map-simple.html

http://www.spotdiving.com/bug.png

var viewportBox;
google.maps.event.addListener(this.map, 'idle', function(event)
{
    var bounds = map.getBounds();

    var ne = bounds.getNorthEast();
    var sw = bounds.getSouthWest();

    var viewportPoints = [
        ne, new google.maps.LatLng(ne.lat(), sw.lng()),
        sw, new google.maps.LatLng(sw.lat(), ne.lng()), ne
    ];

    if (viewportBox)
    {
        viewportBox.setPath(viewportPoints);
    } else
    {
        viewportBox = new google.maps.Polyline({
            path: viewportPoints,
            strokeColor: '#FF0000',
            strokeOpacity: 1.0,
            strokeWeight: 4
        });
        viewportBox.setMap(map);
    }
});

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-js-api-v3/-/2KmJMArvIx0J.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to