[Users] Automatically zooming to layer extent

Peerasak Wangsom pwangsom at gmail.com
Thu Nov 3 07:33:17 CET 2011


Dear all,

I try to automatically zoom map to maximum extent of layer after adding
layer to map.
I tried to code like this.

var layer = OpenLayers.Layer.WMS(.......);

map.addLayer(layer);

map.zoomToExtent(layer.getDataExtent());

But it doesnt' work. I also changed like this

map.zoomToExtent(layer.getMaxExtent());

It still doesn't work. What can I do to solve this issue.

Thank you.
wangsom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20111103/7e920cfa/attachment.htm 


More information about the Users mailing list