logo

What's This?
News
How to Use
Requirements
Download
Help Me

Japanese

What's This?

gpx2shp converts the GPS Exchange Format(*.gpx) to ESRI/shape format(*.shp) written by C.

They are easy to use (maybe), light and free on GPL. About GPX format is available on http://www.topografix.com/gpx.asp  

NEWS

0.71 released.
- Fixed build failures with the proj4 version 1.8(Debian Bug report logs - #733381) (3/2/2014)

0.70 released.
- Supported 1 line gpx.
- Reliability improvement.
- Applied Rodney's patch that tracks which didn't have elements
- Fixed a bug reported by forallsecure. http://www.forallsecure.com/bug-reports/6dd67 30b963ea2c4886aee521508d95215f11ab2/
(7/6/2013)

Windows binary available
I compiled gpx2shp on Windows using MINGW. But I'm not sure it can run on your PC so please let me know it can execute or not on your environment.
(2/25/2005)

New and abandon targets.
I targeted svg futures and gps2shp but I stop to make them.  Because I found some SVG tools on the web (a example 'assvg()' in PostGIS) and a unix tool should be compact.  However I will make shp2gpx on the other hand because it seems to be needed by not few people according to the access log.
(2/20/2005)

0.69 released.
Bug fix(Debian Bug #292514: Segfaults when called only with -v) and Add few check targets etc.
(2/20/2005)

rpm available
The rpm package for Vine 3.1 was packed by Susumu Tanimura. You can download it from
http://www.ring.gr.jp/pub/linux/Vine/VinePlus/3.1/i386/
pool/gpx2shp-0.68-1vl1.i386.rpm
now. Thank you Dr. Tanimura.
(1/27/2005)

apt-get available
gpx2shp is added in debian package(testing and unstable). You can install using "apt-get install gpx2shp" now. Thanks Petter Reinholdtsen.
http://packages.debian.org/unstable/science/gpx2shp
(1/10/2005)

0.68 released.
It has big change about XML parser engine from libxml2 to expat because libxml2 uses too much memory to parse a big gpx file. 0.68 only uses few MB and it is completely faster than before. It also added several options -f, -b, --min-points, --min-length and --min-speed. (1/7/2005)

How to Use

Basic

There are three types of data on GPX that are waypoint, trkpoint and route. gpx2shp converts the three data to separated files like below.
Please try to convert a sample file "pinatest2.gpx" in this archive.

prompt> gpx2shp pinatest2.gpx
prompt> ls
pinatest2.gpx (source gpx)
pinatest2_meta.txt (meta data)
pinatest2_rte.dbf (route)
pinatest2_rte.shp (route)
pinatest2_rte.shx (route)
pinatest2_trk.dbf (trackpoint)
pinatest2_trk.shp (trackpoint)
pinatest2_trk.shx (trackpoint)
pinatest2_wpt.dbf (waypoint)
pinatest2_wpt.shp (waypoint)
pinatest2_wpt.shx (waypoint)

You can see 10 files after convertion. The shape format need 3 files for describing a map and gpx format has 3 types of data and metadata so gpx2shp makes 10 of them. Route and track point data is converted as a arc(path) data, waypoint data is converted into point data like the table below.

data type file name format
way point [basename]_wpt.* point
track point [basename]_trk.* arc
route [basename]_rte.* arc
meta data [basename]_meta.txt text

Convert only certain data

You can convert only a certain type of data like only waypoint or track point using option '-w' (waypoint), '-t' (trackpoint) or '-r' (route).

prompt> gpx2shp -r pinatest2.gpx
prompt> ls
pinatest2.gpx (source gpx)
pinatest2_meta.txt (meta data)
pinatest2_rte.dbf (route)
pinatest2_rte.shp (route)
pinatest2_rte.shx (route)

Convert path data to points and etc

As default, track point and route data is converted as a arc data but you can convert it other ways using option '-p'(convert as point) and '-e' (as edge). The edge file has '_edg' in the filename and the point file has '_pnt' in the filename.

prompt> gpx2shp -p -e pinatest2.gpx
prompt> ls
pinatest2_meta.txt
pinatest2_rte.dbf (route path data)
pinatest2_rte.shp
pinatest2_rte.shx
pinatest2_rte_edg.dbf (route each edge)
pinatest2_rte_edg.shp
pinatest2_rte_edg.shx
pinatest2_rte_pnt.dbf (route each point)
pinatest2_rte_pnt.shp
pinatest2_rte_pnt.shx
pinatest2_trk.dbf (track path data)
pinatest2_trk.shp
pinatest2_trk.shx
pinatest2_trk_edg.dbf (track each each)
pinatest2_trk_edg.shp
pinatest2_trk_edg.shx
pinatest2_trk_pnt.dbf (track each point)
pinatest2_trk_pnt.shp
pinatest2_trk_pnt.shx
pinatest2_wpt.dbf (waypoint is always as point)
pinatest2_wpt.shp
pinatest2_wpt.shx

Statistics

If you add '-s' option you can see a conversion summery.

prompt> gpx2shp -s pinatest2.gpx
Track Points:
    track count: 4
    point count: 658
    total length: 156565.627989
    unconverted: 0( 0.00%)
Routes:
    route count: 1
    point count: 323
    total length: 9258.618971
    unconverted: 0( 0.00%)
Waypoints:
    point count: 118

Noise reduction

gpx2shp has several thresholds to reduce the noise path data. The value can set as '--min-points', '--min-length' and '--min-time'. Please try a example below.

prompt> gpx2shp --min-points 6 -s pinatest2.gpx
gpx2shp:../pinatest2.gpx:3962 track was not converted because of less then 6 points. 
Track Points:
    track count: 3
    point count: 653
    total length: 156439.490642
    unconverted: 1(25.00%)
Routes:
    route count: 1
    point count: 323
    total length: 9258.618971
    unconverted: 0( 0.00%)
Waypoints:
    point count: 118

Length and time units

You can choose any length related units that are supported by proj4 for attribute table using

'--length-unit'       (for length column, default: m),
'--time-unit'         (for time column, default: sec),
'--speed-length-unit' (for speed column, default: km),
'--speed-time-unit'  (for speed column, default: hour) and
'--length-ellipsoid' (for length calculation, default: UGS84).

You can see the supported units by 'geod -lu' and 'geod -le' command.
Supported time unit are 'sec', 'min', 'hour' and 'day'.

Other futures

There are other futures in gpx2shp. Please check the option list using

gpx2shp --help

Requirements

GNU C library
http://www.gnu.org/software/libc
expat
http://expat.sourceforge.net/
proj-4
http://www.remotesensing.org/

Downloads

Source package and Windows binary.
http://sourceforge.jp/projects/gpx2shp/files/

Debian binary (by Petter Reinholdtsen)
http://packages.debian.org/unstable/science/gpx2shp
Vine3.1 binary(by Susumu Tanimura)
http://www.ring.gr.jp/pub/linux/Vine/VinePlus/3.1/i386/
pool/gpx2shp-0.68-1vl1.i386.rpm

Help Us!

Help wanted
-- binary packages (win, rpms, osx and etc.)
-- GUI environment

Also I'm waiting your bug report and opinion.



sign
SourceForge.jp