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