Finally I got zooming -kind of - working.<br>But It works only on the LAST track added to the map.<br><br>When I take my test4 example and reverse the order of tracks, it zooms in on the smaller, red one:<br><br><a href="http://mybestprojects.com/data/test4/test4.html">http://mybestprojects.com/data/test4/test4.html</a><br>

<br>However it should work on data of all tracks. Zooming in on the &quot;largest&quot;.<br><br>Your thoughts please?<br><br>To Christopher:<br>I understood the 4 arguments of  &#39;options&#39; are optional, and set to &quot;true&quot; by default?<br>

<br>Also I am not complaining at all about nothing. <br>And yes, there are &quot;usage errors&quot;. <br>Mostly from copying code from various examples (on and offsite <a href="http://openlayers.org">openlayers.org</a>), which seem to be out of date and/or not reflecting best practise. It&#39;s called learning. Levels of skills are different after all.<br>

Again, not complaining.<br>
<br>I intend to update a few of those examples once I got it together myself.<br><br>Thanks,<br>Jan<br><br><br><div class="gmail_quote">On Tue, Jun 9, 2009 at 12:12 AM, Christopher Schmidt <span dir="ltr">&lt;<a href="mailto:crschmidt@metacarta.com">crschmidt@metacarta.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;"><div class="im">On Mon, Jun 08, 2009 at 11:52:27PM +0200, Jan Martin wrote:<br>
&gt; Yes I did,<br>
&gt;<br>
&gt; it&#39;s as frustrating as all the examples at<br>
&gt; <a href="http://openlayers.org/dev/examples" target="_blank">http://openlayers.org/dev/examples</a><br>
&gt;<br>
&gt; All the lat, lon and zoom are always hardcoded. Not dynamic as I need it.<br>
&gt; So not helpfull.<br>
&gt;<br>
&gt; Please find a screenshot of what I did using shell and perl scripts I wrote<br>
&gt; today and gpsbabel:<br>
&gt;<br>
&gt; From thousands of lines like this:<br>
&gt; 1244296533    1    8.664075    49.993945    172.012836<br>
&gt;<br>
&gt; to this:<br>
&gt; <a href="http://mybestprojects.com/data/test3/Skytraq-Venus_6-GPS_tracks.png" target="_blank">http://mybestprojects.com/data/test3/Skytraq-Venus_6-GPS_tracks.png</a><br>
&gt;<br>
&gt; Nice eh?<br>
&gt; Now how to make this zoom working?<br>
<br>
<br>
</div><a href="http://dev.openlayers.org/apidocs/files/OpenLayers/Layer/GML-js.html#OpenLayers.Layer.GML.OpenLayers.Layer.GML" target="_blank">http://dev.openlayers.org/apidocs/files/OpenLayers/Layer/GML-js.html#OpenLayers.Layer.GML.OpenLayers.Layer.GML</a><br>


<br>
Parameters<br>
  name    {String}<br>
  url {String} URL of a GML file.<br>
  options {Object} Hashtable of extra options to tag onto the layer.<br>
<br>
You have four arguments. As a result, your &#39;options&#39; is a string --<br>
meaning that you haven&#39;t configured your GML layer to parse GPX. As a<br>
result, there are no features on your layer -- and therefore, nothing<br>
rawn, and nothing to zoom to.<br>
<br>
<br>
Additionally, you&#39;re using data in 4326 on a map in 900913, and haven&#39;t<br>
put in a projection option on your layer<br>
(<a href="http://docs.openlayers.org/library/spherical_mercator.html#reprojecting-vector-data" target="_blank">http://docs.openlayers.org/library/spherical_mercator.html#reprojecting-vector-data</a>), so this won&#39;t work until you do that as well.<br>


<br>
I appreciate that our documentation is imperfect. (Help welcome on that<br>
front.) However, complaining about that when you have clear usage errors<br>
is frustrating to people who might help you.<br>
<br>
(I will give you credit for following<br>
<a href="http://docs.openlayers.org/help/minimize.html#publishing-your-problem" target="_blank">http://docs.openlayers.org/help/minimize.html#publishing-your-problem</a> at<br>
least, since without that, there&#39;s no way we&#39;d see the problem.)<br>
<br>
-- Chris<br>
<div><div></div><div class="h5"><br>
<br>
&gt; Jan<br>
&gt;<br>
&gt; On Mon, Jun 8, 2009 at 11:32 PM, Vivien Deparday<br>
&gt; &lt;<a href="mailto:vivien.deparday@gmail.com">vivien.deparday@gmail.com</a>&gt;wrote:<br>
&gt;<br>
&gt; &gt; Did you have a look at this:<br>
&gt; &gt; <a href="http://wiki.openstreetmap.org/wiki/Openlayers_Track_example" target="_blank">http://wiki.openstreetmap.org/wiki/Openlayers_Track_example</a><br>
&gt; &gt;<br>
&gt; &gt; Cheers,<br>
&gt; &gt;<br>
&gt; &gt; Vivien<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Jan Martin wrote:<br>
&gt; &gt;<br>
&gt; &gt;&gt; Hi Arndt,<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; OK, I should have told that the code is borrowed from<br>
&gt; &gt;&gt; <a href="http://oms.wff.ch/ol_track.htm" target="_blank">http://oms.wff.ch/ol_track.htm</a> and <a href="http://nuug.no/kart.shtml" target="_blank">http://nuug.no/kart.shtml</a><br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; So I cleaned up the file and also got rid of GPX.js as well as Ajax.js.<br>
&gt; &gt;&gt; Still doesn&#39;t work. No zoom, not even a track anymore.<br>
&gt; &gt;&gt; Firebug reports: bounds is null<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Check it out:<br>
&gt; &gt;&gt; <a href="http://mybestprojects.com/data/test3/tracks_layers.html" target="_blank">http://mybestprojects.com/data/test3/tracks_layers.html</a><br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Thanks,<br>
&gt; &gt;&gt; Jan<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; On Mon, Jun 8, 2009 at 9:21 PM, Arnd Wippermann &lt;<a href="mailto:arnd.wippermann@web.de">arnd.wippermann@web.de</a>&lt;mailto:<br>
&gt; &gt;&gt; <a href="mailto:arnd.wippermann@web.de">arnd.wippermann@web.de</a>&gt;&gt; wrote:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;    Hi Jan,<br>
&gt; &gt;&gt;        It seems, that your code GPX.js (OpenLayers.Layer.GPX) miss<br>
&gt; &gt;&gt;    something like<br>
&gt; &gt;&gt;                this.events.triggerEvent(&quot;loadend&quot;);<br>
&gt; &gt;&gt;    you should have mentioned, that you use own code for<br>
&gt; &gt;&gt;    OpenLayers.Layer.GPX.<br>
&gt; &gt;&gt;        Arnd<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;  ------------------------------------------------------------------------<br>
&gt; &gt;&gt;    *Von:* <a href="mailto:users-bounces@openlayers.org">users-bounces@openlayers.org</a><br>
&gt; &gt;&gt;    &lt;mailto:<a href="mailto:users-bounces@openlayers.org">users-bounces@openlayers.org</a>&gt;<br>
&gt; &gt;&gt;    [mailto:<a href="mailto:users-bounces@openlayers.org">users-bounces@openlayers.org</a><br>
&gt; &gt;&gt;    &lt;mailto:<a href="mailto:users-bounces@openlayers.org">users-bounces@openlayers.org</a>&gt;] *Im Auftrag von *Jan Martin<br>
&gt; &gt;&gt;    *Gesendet:* Montag, 8. Juni 2009 19:15<br>
&gt; &gt;&gt;    *An:* Vivien Deparday<br>
&gt; &gt;&gt;    *Cc:* <a href="mailto:users@openlayers.org">users@openlayers.org</a> &lt;mailto:<a href="mailto:users@openlayers.org">users@openlayers.org</a>&gt;<br>
&gt; &gt;&gt;    *Betreff:* Re: [OpenLayers-Users] Going nuts: getDataExtent<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;    Hi Vivien,<br>
&gt; &gt;&gt;    hi all,<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;    unfortunately it did not work.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;    Changed file here:<br>
&gt; &gt;&gt;    <a href="http://mybestprojects.com/data/test2/tracks_layers.html" target="_blank">http://mybestprojects.com/data/test2/tracks_layers.html</a><br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;    I also would prefer the &quot;try to register the same function but<br>
&gt; &gt;&gt;    before adding the layer&quot; method, and NOT &quot;within the constructor&quot;.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;    Thanks,<br>
&gt; &gt;&gt;    Jan<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;    On Mon, Jun 8, 2009 at 5:47 PM, Vivien Deparday<br>
&gt; &gt;&gt;    &lt;<a href="mailto:vivien.deparday@gmail.com">vivien.deparday@gmail.com</a> &lt;mailto:<a href="mailto:vivien.deparday@gmail.com">vivien.deparday@gmail.com</a>&gt;&gt; wrote:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;        I think it&#39;s because you register your function on the event<br>
&gt; &gt;&gt;        loadend but the layer is already added and the event loadend<br>
&gt; &gt;&gt;        has already been fired. So, try to register the same function<br>
&gt; &gt;&gt;        but before adding the layer. You can even do it within the<br>
&gt; &gt;&gt;        constructor with the option eventListeners. I guess it would<br>
&gt; &gt;&gt;        look like something like this but I&#39;m not sure as I never used<br>
&gt; &gt;&gt;        the gpx format.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;        var lgpx = new OpenLayers.Layer.GPX(&quot;20090606175533.gpx&quot;,<br>
&gt; &gt;&gt;        &quot;separated/20090606175533.gpx&quot;, &quot;#FF0000&quot;,{eventListeners:<br>
&gt; &gt;&gt;        {&#39;loadend&#39;: function(){this.zoomToExtent(lgpx.getDataExtent())<br>
&gt; &gt;&gt;        }}});<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;        Let me know if it helps.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;        Vivien Deparday<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;        Jan Martin wrote:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;            Hi all,<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;            I am going nuts over not beeing able to figure out how to<br>
&gt; &gt;&gt;            make getDataExtent work for me.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;            This is my page NOT working yet:<br>
&gt; &gt;&gt;            <a href="http://mybestprojects.com/data/test/tracks_layers.html" target="_blank">http://mybestprojects.com/data/test/tracks_layers.html</a><br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;            I try to model after<br>
&gt; &gt;&gt;            <a href="http://oms.wff.ch/ol_track.htm" target="_blank">http://oms.wff.ch/ol_track.htm</a> (tracks work fine, just<br>
&gt; &gt;&gt;            zoom in on the red point manually.)<br>
&gt; &gt;&gt;            and<br>
&gt; &gt;&gt;            <a href="http://nuug.no/kart.shtml" target="_blank">http://nuug.no/kart.shtml</a> (automatic zoom by getDataExtent<br>
&gt; &gt;&gt;            not working for me.)<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;            Code in question might be:<br>
&gt; &gt;&gt;                   if( ! map.getCenter() ){<br>
&gt; &gt;&gt;                      lgpx.events.register(&#39;loadend&#39;, map,<br>
&gt; &gt;&gt;            function(){this.zoomToExtent(lgpx.getDataExtent())});<br>
&gt; &gt;&gt;                       map.setCenter(null, null);<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;                   }<br>
&gt; &gt;&gt;             or check out whole page source at<br>
&gt; &gt;&gt;            <a href="http://mybestprojects.com/data/test/tracks_layers.html" target="_blank">http://mybestprojects.com/data/test/tracks_layers.html</a><br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;            What&#39;s wrong?<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;            Thanks,<br>
&gt; &gt;&gt;            Jan<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;  ------------------------------------------------------------------------<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;            _______________________________________________<br>
&gt; &gt;&gt;            Users mailing list<br>
&gt; &gt;&gt;            <a href="mailto:Users@openlayers.org">Users@openlayers.org</a> &lt;mailto:<a href="mailto:Users@openlayers.org">Users@openlayers.org</a>&gt;<br>
&gt; &gt;&gt;            <a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; ------------------------------------------------------------------------<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; _______________________________________________<br>
&gt; &gt;&gt; Users mailing list<br>
&gt; &gt;&gt; <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
&gt; &gt;&gt; <a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
<br>
&gt; _______________________________________________<br>
&gt; Users mailing list<br>
&gt; <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
&gt; <a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
<br>
<br>
</div></div><font color="#888888">--<br>
Christopher Schmidt<br>
MetaCarta<br>
</font></blockquote></div><br>