[OpenLayers-Users] Ho to zoom to the extents of a layer

Christopher Schmidt crschmidt at metacarta.com
Wed Nov 18 11:16:30 EST 2009


On Wed, Nov 18, 2009 at 04:50:05PM +0100, Jakob Voss wrote:
>    map.zoomToExtent( kml.getExtent() );

map.zoomToExtent( kml.getDataExtent() );

http://dev.openlayers.org/apidocs/files/OpenLayers/Layer/Vector-js.html#OpenLayers.Layer.Vector.getDataExtent
 
> The getExtent() method of OpenLayers.Layer does only return the current 
> viewport but not the whole extend. The following does not works neither:
> 
>    map.zoomToExtent( kml.maxExtent );
> 
> I think the problem is that the KML layer may lie outside of the current 
> viewport and so it does not get loaded (?) I just want to get the 
> smallest bounding box that contains all coordinates in the KML file. How 
> can you do this?
> 
> Thanks!
> Jakob
> 
> -- 
> Jakob Voß <jakob.voss at gbv.de>, skype: nichtich
> Verbundzentrale des GBV (VZG) / Common Library Network
> Platz der Goettinger Sieben 1, 37073 Göttingen, Germany
> +49 (0)551 39-10242, http://www.gbv.de
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list