[Geojson] GPX to GeoJson Conversion
Chadwick, Bill
Bill.Chadwick at thalesgroup.com
Fri Aug 22 00:32:18 PDT 2008
Hi,
To enable cross domain AJAX reading of GPX files, I have put together a GPX
to GeoJson converter REST web service
I have used a FeatureCollection to represent the set of waypoints, routes
and tracks in the GPX file - its own 'properties' include the gpxversion and
creator elements from the GPX file. Then
1) 'Point's for way-points with a set of 'properties' corresponding to
the waypoint's descriptive elements (name etc)
2) 'MultiLineString' for a track (one string of points per track
segment) with a set of 'properties' corresponding to the track's descriptive
elements
3) 'GeometryCollection' for a route (the collection holds the set of
route points as 'Point's) with a set of properties corresponding to the
route's descriptive elements
The Route presents a bit of a problem. I have put individual node properties
on each GeometryCollection child - good JSON but outside the GeoJson spec.
These properties are key for a route e.g. "cmt":"turn left for the pub". I
had to use a GeometryCollection for the Route as a FeatureCollection can't
contain a FeatureCollection. Sadly the OpenLayers 2.6 GeoJson parser ignores
the 'properties' on the GeometryCollection members.
You can see example track+waypoint output here
http://gpx2geojson.appspot.com?gpxurl=http://wheresthepath.googlepages.com/s
winleyforest.gpx
and example route output here
http://gpx2geojson.appspot.com?gpxurl=http://wheresthepath.googlepages.com/r
oute.gpx
other parameters are
ele=1 - make 3D coords from 3D input (not compatible with
OpenLayers)
callback=cb - name of callback function
Any suggestions for a better way of handling the Route ?
Bill Chadwick
http://wheresthepath.googlepages.com/wheresthepath.htm
*******************************************************************************
Please consider the environment before printing this email.
*******************************************************************************
This email and any files transmitted with it are intended solely for the use of
the individual or entity to whom they are addressed and may not be divulged to
any third party without the express permission of the originator. Any views
expressed in this message are those of the individual sender, except where the
sender specifically states them to be the views of Thales Research & Technology
(UK) Limited.
*******************************************************************************
More information about the GeoJSON
mailing list