Hi Andreas,<br><br>thanks for your help.<br><br>I hope I changed my file right, but unfortunately its not working:<br><br><a href="http://mybestprojects.com/data/test5/test5.html">http://mybestprojects.com/data/test5/test5.html</a><br>
<br>Also I have no clue how to implement Format.GPX::read<br>There are no results of anybody using it when googling for it. <br>Can't be can it?<br><br>Jan<br><br><div class="gmail_quote">On Thu, Jun 11, 2009 at 6:07 PM, Andreas Hocevar <span dir="ltr"><<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</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><div></div><div class="h5">Hi Jan,<br>
<br>
one more thing that came to my mind: are you aware that you are<br>
working with two layers here? From what you wrote, it seems you think<br>
that you have one layer lgpx. But in fact you have two, you just use<br>
the same variable for both.<br>
<br>
You could also solve your problem with just one layer, but then you<br>
would have to use Format.GPX::read to get the features from both urls.<br>
You would also have to take care to style the features properly (red<br>
from one url, green from the other).<br>
<br>
I guess the way you chose is simpler, you just have to be aware that<br>
you are working with two layers.<br>
<br>
Regards,<br>
Andreas.<br>
<br>
On Thu, Jun 11, 2009 at 5:55 PM, Andreas Hocevar<<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</a>> wrote:<br>
> Hi Jan,<br>
><br>
> On Thu, Jun 11, 2009 at 5:20 PM, Jan Martin<<a href="mailto:janmartin3@googlemail.com">janmartin3@googlemail.com</a>> wrote:<br>
>> Hi all,<br>
>><br>
>> right now getDataExtent() only considers the data added LAST (red).<br>
>> But I need the map to zoom in on ALL data in lgpx (green AND red).<br>
>><br>
>> What's my error?<br>
><br>
> you need to take into account the dataExtent of both layers:<br>
><br>
> var dataExtent;<br>
> var setExtent = function() {<br>
> dataExtent = dataExtent ? this.getDataExtent() :<br>
> this.getDataExtent().extend(dataExtent);<br>
> map.zoomToExtent(dataExtent);<br>
> }<br>
> lgpx = new OpenLayers.Layer.GML<br>
> ("green","separated/20090607172151.gpx",{<br>
> projection: new OpenLayers.Projection("EPSG:4326"),<br>
> style: {strokeColor: "green", strokeWidth: 5, strokeOpacity: 0.8},<br>
> format: OpenLayers.Format.GPX,});<br>
> lgpx.events.register("loadend", lgpx, setExtent);<br>
> map.addLayer(lgpx);<br>
> lgpx = new OpenLayers.Layer.GML<br>
> ("red","separated/20090607110550.gpx",{<br>
> projection: new OpenLayers.Projection("EPSG:4326"),<br>
> style: {strokeColor: "red", strokeWidth: 5, strokeOpacity: 0.8},<br>
> format: OpenLayers.Format.GPX,});<br>
> lgpx.events.register("loadend", lgpx, setExtent);<br>
> map.addLayer(lgpx);<br>
><br>
> Regards,<br>
> Andreas.<br>
<br>
<br>
--<br>
Andreas Hocevar<br>
OpenGeo - <a href="http://opengeo.org/" target="_blank">http://opengeo.org/</a><br>
Expert service straight from the developers.<br>
</div></div><div><div></div><div class="h5">_______________________________________________<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>
</div></div></blockquote></div><br>