[OpenLayers-Users] any API to zoom to fit?

Alexandre Dube adube at mapgears.com
Mon Jun 27 12:57:47 EDT 2011


Hi,

   Yes :

   mapObject.zoomToExtent(polygonObject.getBounds());

http://dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.zoomToExtent
http://dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/OpenLayers/Geometry-js.html#OpenLayers.Geometry.getBounds

Regards,

Alexandre


On 11-06-27 10:34 AM, JK Chen wrote:
>
> Hi,
>
> Given a polygon, is there an OpenLayers API that will automatically 
> zoom the map to fit the polygon, similar to GMap API getBoundsZoomLevel()?
>
> Thanks.
>
> JK
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users


-- 
Alexandre Dubé
Mapgears
www.mapgears.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110627/9841dbef/attachment-0001.html


More information about the Users mailing list