[OpenLayers-Users] hiking trail

Frank Broniewski brfr at metrico.lu
Mon Oct 6 03:31:35 EDT 2008


Hi Markus,

I include KML files with a GPS track from my hiking tours with my dog into an 
Openlayers application. Though I do not (yet) use a point layer with 
additional information, it shouldn't be too hard to integrate.

If you look at the source code of the page ( 
http://clydeswelt.frabron.de/archives/8-KML-Layer-Test.html ), you will find 
three important javascript parts. First two include Openlayers javascript and 
Openstreetmap javascript files. The second is inline javascript and there you 
can see how things are set up. The map has two layers, one openstreetmap base 
layer and the kml file with the gps track. This should get you going.

I haven't tested yet the new GPX layer type in OL 2.7, but I am not sure, if 
it is possible to use different geometry types in one layer - I suppose not. 
So you would basically need at least two layers in your application, one for 
the trails and another one for the points. And I have just read GPX format is 
linear features only.
So your best bet would be to transform your GPX files into KML vector files 
and use these. You can transform them using Google Earth. Just dragdrop them 
into GE and save the new layer as a kml file. Then you need to clean up the 
file from unused styles and declaration. Use 
http://clydeswelt.frabron.de/kml/test.kml as a guideline.

Be aware though that using vector data in a browser can lead to serious 
performance problems when the data becomes large. And using data from files 
brings another problem when you include data which is not used in the current 
map extent. There is no extent checking when loading data from a file, so 
everything from your file is loaded even the data currently not visible (out 
of extent).

Using popups is somewhat more difficult. It includes registering events on the 
map  and passing data around. I found popups somewhat hard to understand, but 
there are lots of topics about popups on the list and there are also some 
examples in the examples page. As far as I know, popups only work with point 
data, as they use a marker for anchoring, so I don't know if it is possible 
with your tracks. But you could create a marker dynamically at the click 
location and destroy it again when the popup is created.

Sorry for the verbose answer, but I hope that helps you a little bit. It's a 
complex topic after all ;-)



On Sunday 05 October 2008 23:18:51 Markus wrote:
> Hi Lance,
>
> >> A useful software needs a useful documentation.
>
> Thanks for your links:
> > The gpx format allows wpt,rte and trks in one file.. here is a link to
> > the GPX format http://www.topografix.com/gpx.asp
> >
> > Here is some programmer style documentation of OpenLayers
> > http://dev.openlayers.org/docs/files/OpenLayers-js.htmlx
>
> Unfortunately, I'm not a programmer or developper.
>
> I'm a experianced user, with some basic understanding of programms.
> I'm able to work with an text editor.
> So I may change some code-blocks in the code, or adapt the value of
> variables, or something like this.
>
> But I need an understandable comprehensible how-to.
>
> I think moast users needs it like this.
> So if we want that OSM will grows as application, we needs how-tos for
> all the stuff around OL.
>
> I would like to help doing this, but I need the knowledge of the
> experianced users and programmers.
>
> So lets go practice:
>
> I have:
> - a GPX with ways (hiking trail)
> - a GPX with nodes (POI)
> - for each node and way some text for a popup
>
> How may I
> - store nodes and ways and informations together in one GPX?
> - display it also together in a layer?
>
> Thanks, Markus
>
> PS: What do you mean with this:
> > Have you done this, "ie used the format" and ran in to an error... ?
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users



-- 
Frank Broniewski

Metrico s.àr.l. ( http://www.metrico.lu )
36, rue des Romains 
L-5433 Niederdonven 
Luxembourg

Fon: +352 26 74 94 1 
Fax: +352 26 74 94 99



More information about the Users mailing list