Hi Wangson,

 

Try map.zoomToMaxExtent.

 

See at
http://dev.openlayers.org/docs/files/OpenLayers/Map-js.html#OpenLayers.M
ap.zoomToMaxExtent 

 

Yours,

 

Toni.

 

De: users-boun...@geoext.org [mailto:users-boun...@geoext.org] En nom de
Peerasak Wangsom
Enviat: jueves, 03 de noviembre de 2011 7:33
Per a: users@geoext.org
Tema: [Users] Automatically zooming to layer extent

 

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

_______________________________________________
Users mailing list
Users@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to