[Geojson] GPX files to GeoJSON

Sean Gillies sgillies at frii.com
Thu Jun 25 08:22:36 PDT 2009


On Jun 25, 2009, at 8:44 AM, Christopher Schmidt wrote:

> 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.

I agree, that's a better design.

--
Sean Gillies
sean.gillies at gmail.com
http://sgillies.net




More information about the GeoJSON mailing list