OK, I am answering this one myself:
In
http://wiki.openstreetmap.org/wiki/Openlayers_Track_example
right after
map.addLayer(lgpx);
one needs to add:
lgpx.events.register("loadend", lgpx, function() {
this.map.zoomToExtent(this.getDataExtent()) } );
That's all folks.
Jan
On Sat, Jun 6, 2009 at 8:45 PM, Jan Martin <[email protected]>wrote:
> Hi all,
>
> I am getting more and more frustrated.
>
> After checking out all the examples at http://openlayers.org/dev/examples/
> I noticed that in all examples the variables "lat", "lon" and "zoom" are
> hard-coded.
>
> However I'd like to load a .gpx file like here:
> http://wiki.openstreetmap.org/wiki/Openlayers_Track_example
>
> Then dynamically calculate the "lat", "lon" and "zoom" variables from the
> .gpx data, so the map will always just fit.
>
> I mean, websites like http://www.gpsvisualizer.com and
> http://utrack.crempa.net handle tracks this way, so why not openlayers?
>
> Thanks,
> Jan
>
>
>
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users