[OpenLayers-Users] Problem with zoomexents and google maps layer

Stephen Woodbridge woodbri at swoodbridge.com
Mon Jul 16 14:32:11 EDT 2007


Bill,

Maybe I'm missing something here, but it seems to me that if the 
viewport width is defined by whatever means, and I make an ajax call 
which returns stuff I want to display and the bounds of stuff, that 
calling map.zoomExtents(boundsOfStuff) should zoom the map to an extents 
or scale that will include all my stuff.

Also there is no reason to expect boundsOfStuff to be the same aspect 
ratio of the viewport. I think zoomExtents tries to compute a new 
extents based on the correct aspect ratio and to zoom it to the best 
scale the will show the extents.

This in facts works fine with mapserver and we have never seen a 
problem, but with google we occasionally run into this problem. The 
example Les put together is just one case that reproduces the problem 
for debugging purposes.

Thanks,
   -Steve

Bill Woodall wrote:
> Hi Steve,
> 
> After looking at your example I noticed that you are using CSS
> (width:100%) for your map div and thus the browser will set the viewport
> width and the viewport might never equal the bounds you set.
> 
> ......Bill,
> 
> On Mon, 2007-07-16 at 10:43 -0400, Stephen Woodbridge wrote:
>> Chris,
>>
>> Attached is an html test case. You will probably need to set the google 
>> key to your host. This was run using OL 2.4. Sorry for the file instead 
>> of a URL, I didn't have a host with a google key that was publically 
>> accessible and readily accessible to me to post the example.
>>
>> Les also tried John Cole's suggestion, but that did not solve the 
>> problem either.
>>
>> -Steve
>>
>> Christopher Schmidt wrote:
>>> On Fri, Jul 13, 2007 at 05:43:42PM -0400, Stephen Woodbridge wrote:
>>>> Hi all,
>>>>
>>>> I have run into an annoying issue that if you zoom to an extents the 
>>>> extents is not always inside the viewport, so if I have a bunch of 
>>>> points and zoom to their extents, sometimes some of the points are 
>>>> outside the viewport after the zoom.
>>>>
>>>> Is there a fix or workaround for this problem?
>>> Can you provide a test case for this?
>>>
>>> Regards,
>> HTML page attachment (google-ol-bug.html)
>> OpenLayers With Google Layer Example
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
> 




More information about the Users mailing list