OK, I am answering this one myself:<br><br>In<br><a href="http://wiki.openstreetmap.org/wiki/Openlayers_Track_example" target="_blank">http://wiki.openstreetmap.org/wiki/Openlayers_Track_example</a><br>right after <br>map.addLayer(lgpx);<br>

<br>one needs to add:<br>lgpx.events.register(&quot;loadend&quot;, lgpx, function() {<br>this.map.zoomToExtent(this.getDataExtent()) } );<br><br>That&#39;s all folks.<br><br>Jan<br><br><div class="gmail_quote">On Sat, Jun 6, 2009 at 8:45 PM, Jan Martin <span dir="ltr">&lt;<a href="mailto:janmartin3@googlemail.com">janmartin3@googlemail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi all,<br><br>I am getting more and more frustrated.<br><br>After checking out all the examples at <a href="http://openlayers.org/dev/examples/" target="_blank">http://openlayers.org/dev/examples/</a><br>

I noticed that in all examples the variables &quot;lat&quot;, &quot;lon&quot; and &quot;zoom&quot; are hard-coded.<br>
<br>However I&#39;d like to load a .gpx file like here:<br><a href="http://wiki.openstreetmap.org/wiki/Openlayers_Track_example" target="_blank">http://wiki.openstreetmap.org/wiki/Openlayers_Track_example</a><br><br>Then dynamically calculate the &quot;lat&quot;, &quot;lon&quot; and &quot;zoom&quot; variables from the .gpx data, so the map will always just fit.<br>


<br>I mean, websites like <a href="http://www.gpsvisualizer.com" target="_blank">http://www.gpsvisualizer.com</a> and <a href="http://utrack.crempa.net" target="_blank">http://utrack.crempa.net</a> handle tracks this way, so why not openlayers?<br>

<br>Thanks,<br><font color="#888888">
Jan<br><br><br>
</font></blockquote></div><br>