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 "largest".<br><br>Your thoughts please?<br><br>To Christopher:<br>I understood the 4 arguments of 'options' are optional, and set to "true" by default?<br>
<br>Also I am not complaining at all about nothing. <br>And yes, there are "usage errors". <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'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"><<a href="mailto:crschmidt@metacarta.com">crschmidt@metacarta.com</a>></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>
> Yes I did,<br>
><br>
> it's as frustrating as all the examples at<br>
> <a href="http://openlayers.org/dev/examples" target="_blank">http://openlayers.org/dev/examples</a><br>
><br>
> All the lat, lon and zoom are always hardcoded. Not dynamic as I need it.<br>
> So not helpfull.<br>
><br>
> Please find a screenshot of what I did using shell and perl scripts I wrote<br>
> today and gpsbabel:<br>
><br>
> From thousands of lines like this:<br>
> 1244296533 1 8.664075 49.993945 172.012836<br>
><br>
> to this:<br>
> <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>
><br>
> Nice eh?<br>
> 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 'options' is a string --<br>
meaning that you haven'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're using data in 4326 on a map in 900913, and haven'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'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's no way we'd see the problem.)<br>
<br>
-- Chris<br>
<div><div></div><div class="h5"><br>
<br>
> Jan<br>
><br>
> On Mon, Jun 8, 2009 at 11:32 PM, Vivien Deparday<br>
> <<a href="mailto:vivien.deparday@gmail.com">vivien.deparday@gmail.com</a>>wrote:<br>
><br>
> > Did you have a look at this:<br>
> > <a href="http://wiki.openstreetmap.org/wiki/Openlayers_Track_example" target="_blank">http://wiki.openstreetmap.org/wiki/Openlayers_Track_example</a><br>
> ><br>
> > Cheers,<br>
> ><br>
> > Vivien<br>
> ><br>
> ><br>
> > Jan Martin wrote:<br>
> ><br>
> >> Hi Arndt,<br>
> >><br>
> >> OK, I should have told that the code is borrowed from<br>
> >> <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>
> >><br>
> >> So I cleaned up the file and also got rid of GPX.js as well as Ajax.js.<br>
> >> Still doesn't work. No zoom, not even a track anymore.<br>
> >> Firebug reports: bounds is null<br>
> >><br>
> >> Check it out:<br>
> >> <a href="http://mybestprojects.com/data/test3/tracks_layers.html" target="_blank">http://mybestprojects.com/data/test3/tracks_layers.html</a><br>
> >><br>
> >> Thanks,<br>
> >> Jan<br>
> >><br>
> >> On Mon, Jun 8, 2009 at 9:21 PM, Arnd Wippermann <<a href="mailto:arnd.wippermann@web.de">arnd.wippermann@web.de</a><mailto:<br>
> >> <a href="mailto:arnd.wippermann@web.de">arnd.wippermann@web.de</a>>> wrote:<br>
> >><br>
> >> Hi Jan,<br>
> >> It seems, that your code GPX.js (OpenLayers.Layer.GPX) miss<br>
> >> something like<br>
> >> this.events.triggerEvent("loadend");<br>
> >> you should have mentioned, that you use own code for<br>
> >> OpenLayers.Layer.GPX.<br>
> >> Arnd<br>
> >><br>
> >> ------------------------------------------------------------------------<br>
> >> *Von:* <a href="mailto:users-bounces@openlayers.org">users-bounces@openlayers.org</a><br>
> >> <mailto:<a href="mailto:users-bounces@openlayers.org">users-bounces@openlayers.org</a>><br>
> >> [mailto:<a href="mailto:users-bounces@openlayers.org">users-bounces@openlayers.org</a><br>
> >> <mailto:<a href="mailto:users-bounces@openlayers.org">users-bounces@openlayers.org</a>>] *Im Auftrag von *Jan Martin<br>
> >> *Gesendet:* Montag, 8. Juni 2009 19:15<br>
> >> *An:* Vivien Deparday<br>
> >> *Cc:* <a href="mailto:users@openlayers.org">users@openlayers.org</a> <mailto:<a href="mailto:users@openlayers.org">users@openlayers.org</a>><br>
> >> *Betreff:* Re: [OpenLayers-Users] Going nuts: getDataExtent<br>
> >><br>
> >> Hi Vivien,<br>
> >> hi all,<br>
> >><br>
> >> unfortunately it did not work.<br>
> >><br>
> >> Changed file here:<br>
> >> <a href="http://mybestprojects.com/data/test2/tracks_layers.html" target="_blank">http://mybestprojects.com/data/test2/tracks_layers.html</a><br>
> >><br>
> >> I also would prefer the "try to register the same function but<br>
> >> before adding the layer" method, and NOT "within the constructor".<br>
> >><br>
> >> Thanks,<br>
> >> Jan<br>
> >><br>
> >> On Mon, Jun 8, 2009 at 5:47 PM, Vivien Deparday<br>
> >> <<a href="mailto:vivien.deparday@gmail.com">vivien.deparday@gmail.com</a> <mailto:<a href="mailto:vivien.deparday@gmail.com">vivien.deparday@gmail.com</a>>> wrote:<br>
> >><br>
> >> I think it's because you register your function on the event<br>
> >> loadend but the layer is already added and the event loadend<br>
> >> has already been fired. So, try to register the same function<br>
> >> but before adding the layer. You can even do it within the<br>
> >> constructor with the option eventListeners. I guess it would<br>
> >> look like something like this but I'm not sure as I never used<br>
> >> the gpx format.<br>
> >><br>
> >> var lgpx = new OpenLayers.Layer.GPX("20090606175533.gpx",<br>
> >> "separated/20090606175533.gpx", "#FF0000",{eventListeners:<br>
> >> {'loadend': function(){this.zoomToExtent(lgpx.getDataExtent())<br>
> >> }}});<br>
> >><br>
> >> Let me know if it helps.<br>
> >><br>
> >> Vivien Deparday<br>
> >><br>
> >> Jan Martin wrote:<br>
> >><br>
> >> Hi all,<br>
> >><br>
> >> I am going nuts over not beeing able to figure out how to<br>
> >> make getDataExtent work for me.<br>
> >><br>
> >> This is my page NOT working yet:<br>
> >> <a href="http://mybestprojects.com/data/test/tracks_layers.html" target="_blank">http://mybestprojects.com/data/test/tracks_layers.html</a><br>
> >><br>
> >> I try to model after<br>
> >> <a href="http://oms.wff.ch/ol_track.htm" target="_blank">http://oms.wff.ch/ol_track.htm</a> (tracks work fine, just<br>
> >> zoom in on the red point manually.)<br>
> >> and<br>
> >> <a href="http://nuug.no/kart.shtml" target="_blank">http://nuug.no/kart.shtml</a> (automatic zoom by getDataExtent<br>
> >> not working for me.)<br>
> >><br>
> >> Code in question might be:<br>
> >> if( ! map.getCenter() ){<br>
> >> lgpx.events.register('loadend', map,<br>
> >> function(){this.zoomToExtent(lgpx.getDataExtent())});<br>
> >> map.setCenter(null, null);<br>
> >><br>
> >><br>
> >> }<br>
> >> or check out whole page source at<br>
> >> <a href="http://mybestprojects.com/data/test/tracks_layers.html" target="_blank">http://mybestprojects.com/data/test/tracks_layers.html</a><br>
> >><br>
> >> What's wrong?<br>
> >><br>
> >> Thanks,<br>
> >> Jan<br>
> >><br>
> >><br>
> >><br>
> >> ------------------------------------------------------------------------<br>
> >><br>
> >> _______________________________________________<br>
> >> Users mailing list<br>
> >> <a href="mailto:Users@openlayers.org">Users@openlayers.org</a> <mailto:<a href="mailto:Users@openlayers.org">Users@openlayers.org</a>><br>
> >> <a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
> >><br>
> >><br>
> >><br>
> >><br>
> >> ------------------------------------------------------------------------<br>
> >><br>
> >> _______________________________________________<br>
> >> Users mailing list<br>
> >> <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
> >> <a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
> >><br>
> >><br>
> ><br>
> ><br>
<br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
> <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>