The same function is also available for vector layers;<br><a 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 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 href="http://www.otherrealm.org" target="_blank">http://www.otherrealm.org</a>
<a 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 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 href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a 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>