[OpenLayers-Users] ZoomToExtent of KML File

Christopher Schmidt crschmidt at metacarta.com
Fri Sep 12 17:09:09 EDT 2008


On Fri, Sep 12, 2008 at 04:21:09PM -0400, Patrick Markiewicz wrote:
> Hi,
> 
>     If I just want to zoom to the center of the geographic bounding box
> of a KML file that I have defined, what functions would I use?  I tried
> using layer.getExtent, but that returns null for overlays.  I.e. my
> baselayer is a map of the world, and my kml file is somewhere on that
> world.  So how do I zoom and pan to the proper location so that my KML
> file is displayed.  Currently I have a fixed extent, and that means any
> kml file outside of that extent is not visible.  Thanks.

In 2.7, getDataExtent().getCenterLonLat() should probably work.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list