[OpenLayers-Users] ZoomToExtent of KML File

Patrick Markiewicz pmarkiewicz at sim-gtech.com
Mon Sep 15 10:40:48 EDT 2008


When I do this, the getDataExtent() returns null.  Does the KML need to
contain something specific for this to work?  Thanks.


-----Original Message-----
From: Christopher Schmidt [mailto:crschmidt at metacarta.com] 
Sent: Friday, September 12, 2008 5:09 PM
To: Patrick Markiewicz
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] ZoomToExtent of KML File

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