[Geojson] GPX files to GeoJSON

John Smith delta_foxtrot at yahoo.com
Wed Jun 24 23:05:43 PDT 2009


I've looked into the GeoJSON specs and I'm curious as to the way GPX to GeoJSON conversions are handled.

At most the information converted only includes the latitude and longitude, where as GPX files generally contain a lot more useful information, at the very minimum the time stamp is required, along with optional fields like elevation, HDOP or other dilution of precision information.

While I think it's a good idea in general to come to some sort of agreement on a common format, I don't think GeoJSON spec hit the mark entirely.

Also I noticed an email sent to the list about a schema to parse/describe, but that's defeating the point of JSON since it is a bad idea in general to outsource your parsing to someone else.

Take this example I pulled from OSM at random: http://www.openstreetmap.org/trace/423839/data

It contains redundant information of speed which can be calculated, and hdop is more informative than the number of satellites and if you have a 2d or 3d fix. That aside, the information produced comes out a lot less useful when converted to GeoJSON.

http://gpx2geojson.appspot.com?gpxurl=http://www.openstreetmap.org/trace/423839/data

While it's nice to save bytes, I think the lack of field names does more harm than good and further breaks the intent of JSON, especially since compression can save all the bytes you need.

Also instead of breaking existing specs, may I be so bold as to propose extending the current spec to include another geometry type of GPStrace, and the coordinate array would be made up of at least the following fields:

latitude, longitude, time

option fields:

elevation, hdop, pdop, vdop, satallites, fix

However each field would need to be labelled, which would allow for greater flexibility for people to extend this even further without breaking the spec.

A full example of what I mean:

{
	"properties":
	{
		"gpxversion":1,
		"gpxcreator":"GPSBabel - http:\/\/www.gpsbabel.org"
	},
	"type":"FeatureCollection",
	"features":
	{
		"properties":
		{
			"gpxtype":"trkType",
			"name":"TRCK3"
		},
		"type":"Feature",
		"geometry":
		{
			"type":"GPStrace",
			"coordinates":
			[
				{"lat":0,"lon":0,"ele":0,"time":0,"hdop":0},
				{"lat":0,"lon":0,"ele":0,"time":0,"hdop":0},
				{"lat":0,"lon":0,"ele":0,"time":0,"hdop":0},
				{"lat":0,"lon":0,"ele":0,"time":0,"hdop":0},
				{"lat":0,"lon":0,"ele":0,"time":0,"hdop":0},
				{"lat":0,"lon":0,"ele":0,"time":0,"hdop":0},
				{"lat":0,"lon":0,"ele":0,"time":0,"hdop":0},
				{"lat":0,"lon":0,"ele":0,"time":0,"hdop":0},
				{"lat":0,"lon":0,"ele":0,"time":0,"hdop":0}
			]
		}
	}
}


      



More information about the GeoJSON mailing list