[Geojson] GPX files to GeoJSON

Christopher Schmidt crschmidt at metacarta.com
Thu Jun 25 07:44:21 PDT 2009


On Thu, Jun 25, 2009 at 08:37:02AM -0600, Sean Gillies wrote:
> A GPS trace isn't a geometry in the GML sense (GeoJSON is inspired by,  
> and fairly faithful to the GML geometry model, or at least a subset).  
> I see two ways to do this without inventing a odd geometry type: 1)  
> every trace point as a GeoJSON feeature with a point geometry (3D  
> even) and time and hdop properties, or 2) a trace as a GeoJSON feature  
> with a multipoint or linestring geometry (3D even) and time and hdop  
> array properties having the same length as your geometry coordinates,  
> perhaps even within a "gpx" object like this:
> 
> { "type": "Feature",
>   "geometry": { "type": "LineString",
>                 "coordinates": [[0.0, 0.0], [1.0, 1.0]]
>                 },
>   "properties": { "gpx": { "hdop": [0, 0], "time": [1..., 2...] } },
>   "title": "GPS trace feature"
>   }
> 
> I believe it was Jeremy Cothran who proposed matching arrays to me. I  
> didn't like it at first, but it's growing on me.

I think that generally, GPS traces like this are expected to be 'lines'
-- at least, if we're talking about mapping trkseg/trkpts into GeoJSON.
A simple reader will usually render a line based on a linestring, so I
like the 'linestring with array of gpx properties. However, I'd do it
like so:

 properties: {
   gpx: [ 
     {hdop: 0, time: 17},
     {hdop: 12, time: 18},
   ] 
 }  

Rather than having each property be an array. 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the GeoJSON mailing list