[OpenLayers-Users] noob question: zoomToExtent() confusion

Tim Jones timwjones at me.com
Wed Jun 8 22:02:13 EDT 2011


I'm very new to OpenLayers, and having trouble figuring out why some code I've written won't work.

I'm trying to automatically zoom the map to a bounding-box, using the map.zoomToExtent() command. My code works perfectly with the WMS map layer, but when I attempt to use it with Google Maps I'm seeing an error.

Here's my functioning code:
http://codepad.org/UCr3Eru4

It returns this nice view of the San Francisco Bay:
http://imgur.com/XhWno

However, when I attempt the same commands using Google Maps layers, using this code:
http://codepad.org/1kry4HBE

The result is a blank area:
http://imgur.com/rRO3y

The Google Maps layer works AOK if I zoom into San Francisco using the manual controls, rather than using zoomToExtent. I'm having the same problem with Cloudmade.

I'm sure I'm missing something simple since I'm so new to this. Any advice would be appreciated! Cheers,

=Tim=




More information about the Users mailing list