GPX: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Brian Wilson (talk | contribs)
mNo edit summary
Line 1: Line 1:
== Overview ==
GPX is a format for exchanging GPS data.
GPX is a format for exchanging GPS data.


Line 10: Line 12:


What this means is that GPS can accomodate everything needed for professional work. There is no reason to throw out data like fix when creating a GPX file.  
What this means is that GPS can accomodate everything needed for professional work. There is no reason to throw out data like fix when creating a GPX file.  
== Extensions ==
The GPX standard allows for arbitrary extensions. Basically anyone can add additional fields to the GPX format, and if the program you are using does not know about the extension, the data contained therein simply is not available.
An example of this is the [http://www.groundspeak.com Groundspeak] format used for [http://geocaching.com geocaching.]
== Loading into PostGis ==
If you want to transfer the contents of a GPX file into a [[PostGIS]] database (and who doesn't!), you can use ogr2ogr.
Download the GPX file from your handheld device, I suggest using [[GPSbabel]].
Then use commands similar to this
# View the contents of the file
'''ogrinfo 20111016_Garmin.gpx'''
Had to open data source read-only.
INFO: Open of `20111016_Garmin.gpx'
      using driver `GPX' successful.
1: waypoints (Point)
2: routes (Line String)
3: tracks (Multi Line String)
4: route_points (Point)
5: track_points (Point)
# Load the GPX file into a database
ogr2ogr -f PostgreSQL PG:"host=localhost user=postgres dbname=OR_Corvallis" \
20111016_Garmin.gpx \
-overwrite GEOMETRY_NAME=the_geom -lco SCHEMA=staging tracks track_points


== External links ==
== External links ==


Some official documentation: http://topografix.com/GPX/1/1/
Some official documentation: http://topografix.com/GPX/1/1/

Revision as of 00:51, 31 October 2011

Overview

GPX is a format for exchanging GPS data.

The three main data types are waypoints, routes, and tracks.

Waypoint: a waypoint, a point of interest, or a named point on a map. Has all the fields need to represent a point collected with GPS including PDOP, type of fix (2d, 3d, dgps) sats in view, etc.

Route: an ordered list of waypoints representing turns

Track: an ordered list of points representing a path. The track segments are represented by waypoints.

What this means is that GPS can accomodate everything needed for professional work. There is no reason to throw out data like fix when creating a GPX file.

Extensions

The GPX standard allows for arbitrary extensions. Basically anyone can add additional fields to the GPX format, and if the program you are using does not know about the extension, the data contained therein simply is not available.

An example of this is the Groundspeak format used for geocaching.

Loading into PostGis

If you want to transfer the contents of a GPX file into a PostGIS database (and who doesn't!), you can use ogr2ogr.

Download the GPX file from your handheld device, I suggest using GPSbabel.

Then use commands similar to this

# View the contents of the file
ogrinfo 20111016_Garmin.gpx 
Had to open data source read-only.
INFO: Open of `20111016_Garmin.gpx'
      using driver `GPX' successful.
1: waypoints (Point)
2: routes (Line String)
3: tracks (Multi Line String)
4: route_points (Point)
5: track_points (Point)

# Load the GPX file into a database
ogr2ogr -f PostgreSQL PG:"host=localhost user=postgres dbname=OR_Corvallis" \
20111016_Garmin.gpx \
-overwrite GEOMETRY_NAME=the_geom -lco SCHEMA=staging tracks track_points

External links

Some official documentation: http://topografix.com/GPX/1/1/