[OpenLayers-Users] Problem with zoomexents and google maps la yer

Stephen Woodbridge woodbri at swoodbridge.com
Mon Jul 16 21:24:24 EDT 2007


Christopher Schmidt wrote:
> On Mon, Jul 16, 2007 at 02:39:32PM -0500, John Cole wrote:
>> It is my experience that when you zoom to a bounding box, you should be able
>> to see the entirety of whatever is in the bounding box :-)  For example, if
>> you zoom to either California or Tennessee, you should see the entire state,
>> which is what happens on our site.
> 
>> shows that the OL viewport extent overlaps the requested extent, instead of
>> containing it.  Using a standard WMS layer instead of the google layer,
>> Stephen's test returns true, so I suspect that the issue is only in the
>> google layer.
> 
> Right, I missed this the first time around. I have a feeling that the
> problem here is the same as all problems with the Google layer --
> OpenLayers assumes that it is unprojected, when in reality, it is
> projected. This only works so well. I'd say this can be filed as a bug
> against OL2.5, though it's possible my resolution of the ticket will
> simply be "Switch to the new GoogleMercator Layer" once that gets into
> trunk.

Chris, John,

Thank you for the assessment. I was afraid this was going to be the 
case. I did a lot of checking on our end before posting. I'm sorry it 
was not initial clearer.

Anyway, I'm looking for a work-around. If we could do something like:

var zoomlevel = map.getZoomForExtent(ci.Bounds);
var bounds = map.getExtentForZoomLevel(zoomlevel);
if (overlaps(bounds, ci.Bounds) && zoomlevel > 0)
    zoomlevel--;

I think this would work. How would we do the equivalent of:

var bounds = map.getExtentForZoomLevel(zoomlevel);

I haven't checked but I doubt that that function already exists.

-Steve



More information about the Users mailing list