<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><font face="Times New Roman, Times,
serif">Great thanks, I'll try it out tomorrow (work related and
I'm off today</font>)<br>
<pre class="moz-signature" cols="72">Aaron E-J
<a class="moz-txt-link-freetext" href="http://www.otherrealm.org">http://www.otherrealm.org</a>
<a class="moz-txt-link-freetext" href="http://www.prospectdesigns.com">http://www.prospectdesigns.com</a>
Vision without action is a daydream,
Action without vision is a nightmare,
One needs both to succeed.
</pre>
On 7/4/2012 3:17 AM, Tobias Reinicke wrote:<br>
</div>
<blockquote
cite="mid:CAPitpCZPefxHsr=6H1m4zPX_XSd-EnfsU45-Azibvkf_16Lt9w@mail.gmail.com"
type="cite">The same function is also available for vector layers;<br>
<a moz-do-not-send="true"
href="http://dev.openlayers.org/docs/files/OpenLayers/Layer/Vector-js.html#OpenLayers.Layer.Vector.getDataExtent">http://dev.openlayers.org/docs/files/OpenLayers/Layer/Vector-js.html#OpenLayers.Layer.Vector.getDataExtent</a>
<div>
<br>
</div>
<div>I presume you will have set your kml layer up somewhere along
the lines of; </div>
<div><br>
</div>
<div>var myKMLLayer = new OpenLayers.Layer.Vector("KML", {<br>
<br>
strategies: [new OpenLayers.Strategy.Fixed()],<br>
protocol: new OpenLayers.Protocol.HTTP({<br>
url: "whatever",<br>
format: new OpenLayers.Format.KML({<br>
extractStyles: true, <br>
extractAttributes: true,<br>
maxDepth: 2<br>
})<br>
})<br>
};<br>
Then all you do is call</div>
<div>map.zoomToExtent(myKMLLayer.getDataExtent());</div>
<div><br>
</div>
<div>That work for you?</div>
<div>
<br>
</div>
<div>Toby</div>
<div><br>
<br>
<br>
<br>
<div class="gmail_quote">On 4 July 2012 01:21, Aaron E-J <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:azintirea@gmail.com" target="_blank">azintirea@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div><font face="Times New Roman, Times, serif">Do you
have, or know where I could find, an example of this
being implemented on KML</font> layer?<span
class="HOEnZb"><font color="#888888"><br>
</font></span>
<pre cols="72"><span class="HOEnZb"><font color="#888888">Aaron E-J
<a moz-do-not-send="true" href="http://www.otherrealm.org" target="_blank">http://www.otherrealm.org</a>
<a moz-do-not-send="true" href="http://www.prospectdesigns.com" target="_blank">http://www.prospectdesigns.com</a></font></span><div class="im">
Vision without action is a daydream,
Action without vision is a nightmare,
One needs both to succeed.
</div></pre>
<div class="im"> On 7/3/2012 5:52 PM, Greg Allensworth
wrote:<br>
</div>
</div>
<div class="im">
<blockquote type="cite">On 7/3/2012 2:11 PM, Aaron E-J
wrote: <br>
<blockquote type="cite">Is there an easy way to center
and zoom the map automatically based on <br>
the placemarks that are on it?I have it so that one
can filter <br>
placemarks based on user input but I'm not sure how
to dynamically <br>
update the map to fit the newly filtered
content.Thanks for any insight <br>
that can be given regarding this matter. <br>
</blockquote>
<br>
An OpenLayers.Layer.Markers instance, has a method
called getDataExtent() This should do most of what you
want. <br>
<br>
It's not automatic, though. You'd still need to call
map.zoomToExtent() after the markers have been added
to the layer. <br>
<br>
<a moz-do-not-send="true"
href="http://dev.openlayers.org/docs/files/OpenLayers/Layer/Markers-js.html"
target="_blank">http://dev.openlayers.org/docs/files/OpenLayers/Layer/Markers-js.html</a>
<br>
<br>
</blockquote>
<br>
<br>
</div>
</div>
<br>
_______________________________________________<br>
Users mailing list<br>
<a moz-do-not-send="true"
href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a moz-do-not-send="true"
href="http://lists.osgeo.org/mailman/listinfo/openlayers-users"
target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<br>
</body>
</html>