[OpenLayers-Users] Is there an easy way to center and zoom the map automatically based on the placemarks that are on it?

Aaron E-J azintirea at gmail.com
Tue Jul 3 17:21:13 PDT 2012


Do you have, or know where I could find, an example of this being 
implemented on KML layer?

Aaron E-J
http://www.otherrealm.org
http://www.prospectdesigns.com
Vision without action is a daydream,
Action without vision is a nightmare,
One needs both to succeed.

On 7/3/2012 5:52 PM, Greg Allensworth wrote:
> On 7/3/2012 2:11 PM, Aaron E-J wrote:
>> Is there an easy way to center and zoom the map automatically based on
>> the placemarks that are on it?I have it so that one can filter
>> placemarks based on user input but I'm not sure how to dynamically
>> update the map to fit the newly filtered content.Thanks for any insight
>> that can be given regarding this matter.
>
> An OpenLayers.Layer.Markers instance, has a method called 
> getDataExtent() This should do most of what you want.
>
> It's not automatic, though. You'd still need to call 
> map.zoomToExtent() after the markers have been added to the layer.
>
> http://dev.openlayers.org/docs/files/OpenLayers/Layer/Markers-js.html
>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120703/bc45b847/attachment.html>


More information about the Users mailing list