[OpenLayers-Users] Zoom 2 Layer

Andreas Hocevar ahocevar at opengeo.org
Thu Aug 23 02:54:53 PDT 2012


getDataExtent only works for layers that are rendered client-side
(i.e. vector layers). For other layers (e.g. WMS), your best bet is to
use OpenLayers.Format.WMSCapabilities and create the layer with the
bbox advertised there as maxExtent, and use
map.zoomToExtent(layer.getMaxExtent()) instead.

Andreas.

On Wed, Aug 22, 2012 at 10:22 PM, Lucho <lucho1524 at gmail.com> wrote:
> Hi List,
>
> I'm trying to create a button with the zoom2layer funcionality, but this
> function map.zoomToExtent(layer_name.getDataExtent()); doesn't return any
> value. I don't know if this is because the layer is an image, not a vector
> layer. Any help with this funcionality will be appreciated.
>
> Best wishes,
>
> --
> LUIS FERNANDO ORTIZ REYES
> INGENIERO DE SISTEMAS
> ESP. EN PROYECTOS INFORMÁTICOS
> UNIVERSIDAD DISTRITAL
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list