1 |
============== |
2 |
gpx2shp README |
3 |
============== |
4 |
Toshihiro Hiraoka |
5 |
1/5/2005 |
6 |
|
7 |
What's This |
8 |
=========== |
9 |
gpx2shp is a converter from GPX file to ESRI/shape file. |
10 |
gps2shp is also a converter from GPS device to shape file but it's not |
11 |
stable yet. |
12 |
This is a output of Metro Manila Transit Map Project by JOCV (Japan |
13 |
Overseas Cooperation Volunteers) program of JICA (Japan International |
14 |
Cooperation Agency in 2004. It is provided you on GPL2. |
15 |
|
16 |
Why I Made |
17 |
========== |
18 |
It's easy. The software converts GPS data to shape file is too much |
19 |
expensive! The cost is same as the one year salary of my co-worker here |
20 |
in the Philippine. GIS is not for only rich countries. |
21 |
|
22 |
How to Use |
23 |
========== |
24 |
- Basic |
25 |
There are three types of data on GPX that are waypoint, trkpoint and |
26 |
route. gpx2shp converts the three data to separated files like below. |
27 |
Please try to convert a sample file "pinatest2.gpx" in this archive. |
28 |
|
29 |
prompt> gpx2shp pinatest2.gpx |
30 |
prompt> ls |
31 |
pinatest2.gpx (source gpx) |
32 |
pinatest2_meta.txt (meta data) |
33 |
pinatest2_rte.dbf (route) |
34 |
pinatest2_rte.shp (route) |
35 |
pinatest2_rte.shx (route) |
36 |
pinatest2_trk.dbf (trackpoint) |
37 |
pinatest2_trk.shp (trackpoint) |
38 |
pinatest2_trk.shx (trackpoint) |
39 |
pinatest2_wpt.dbf (waypoint) |
40 |
pinatest2_wpt.shp (waypoint) |
41 |
pinatest2_wpt.shx (waypoint) |
42 |
|
43 |
You can see 10 files after convertion. The shape format need 3 files |
44 |
for discribing a map and gpx format has 3 types of data and metadata so |
45 |
gpx2shp makes 10 of them. Route and track point data is converted as a |
46 |
arc(path) data, waypoint data is converted into point data like the |
47 |
table below. |
48 |
|
49 |
data type | file name | format |
50 |
-------------+---------------------+-------- |
51 |
waypoint | [basename]_wpt.* | point |
52 |
track point | [basename]_trk.* | arc |
53 |
route | [basename]_rte.* | arc |
54 |
meta data | [basename]_meta.txt | text |
55 |
|
56 |
|
57 |
- Convert only certain data |
58 |
You can convert only a certain type of data like only waypoint or |
59 |
track point using option '-w' (waypoint), '-t' (trackpoint) or '-r' |
60 |
(route). |
61 |
|
62 |
prompt> gpx2shp -r pinatest2.gpx |
63 |
prompt> ls |
64 |
pinatest2.gpx (source gpx) |
65 |
pinatest2_meta.txt (meta data) |
66 |
pinatest2_rte.dbf (route) |
67 |
pinatest2_rte.shp (route) |
68 |
pinatest2_rte.shx (route) |
69 |
|
70 |
- Convert path data to points and etc |
71 |
As default, track point and route data is converted as a arc data but |
72 |
you can convert it other ways using option '-p'(convert as point) and |
73 |
'-e' (as edge). The edge file has '_edg' in the filename and the point |
74 |
file has '_pnt' in the filename. |
75 |
|
76 |
prompt> gpx2shp -p -e pinatest2.gpx |
77 |
prompt> ls |
78 |
pinatest2_meta.txt |
79 |
pinatest2_rte.dbf (route path data) |
80 |
pinatest2_rte.shp |
81 |
pinatest2_rte.shx |
82 |
pinatest2_rte_edg.dbf (route each edge) |
83 |
pinatest2_rte_edg.shp |
84 |
pinatest2_rte_edg.shx |
85 |
pinatest2_rte_pnt.dbf (route each point) |
86 |
pinatest2_rte_pnt.shp |
87 |
pinatest2_rte_pnt.shx |
88 |
pinatest2_trk.dbf (track path data) |
89 |
pinatest2_trk.shp |
90 |
pinatest2_trk.shx |
91 |
pinatest2_trk_edg.dbf (track each each) |
92 |
pinatest2_trk_edg.shp |
93 |
pinatest2_trk_edg.shx |
94 |
pinatest2_trk_pnt.dbf (track each point) |
95 |
pinatest2_trk_pnt.shp |
96 |
pinatest2_trk_pnt.shx |
97 |
pinatest2_wpt.dbf (waypoint is always as point) |
98 |
pinatest2_wpt.shp |
99 |
pinatest2_wpt.shx |
100 |
|
101 |
- Statistics |
102 |
If you add '-s' option you can see a conversion summery. |
103 |
|
104 |
prompt> gpx2shp -s pinatest2.gpx |
105 |
Track Points: |
106 |
track count: 4 |
107 |
point count: 658 |
108 |
total length: 156565.627989 |
109 |
unconverted: 0( 0.00%) |
110 |
Routes: |
111 |
route count: 1 |
112 |
point count: 323 |
113 |
total length: 9258.618971 |
114 |
unconverted: 0( 0.00%) |
115 |
Waypoints: |
116 |
point count: 118 |
117 |
|
118 |
- Noise reduction |
119 |
gpx2shp has several thresholds to reduct the noise path data. The |
120 |
value can set as '--min-points', '--min-length' and '--min-time'. Please |
121 |
try a example below. |
122 |
|
123 |
prompt> gpx2shp --min-points 6 -s pinatest2.gpx |
124 |
gpx2shp:../pinatest3.gpx:3962 track was not converted because of |
125 |
less then 6 points. (<- this path is not converted because the path |
126 |
has only 5 points) |
127 |
Track Points: |
128 |
track count: 3 |
129 |
point count: 653 |
130 |
total length: 156439.490642 |
131 |
unconverted: 1(25.00%) |
132 |
Routes: |
133 |
route count: 1 |
134 |
point count: 323 |
135 |
total length: 9258.618971 |
136 |
unconverted: 0( 0.00%) |
137 |
Waypoints: |
138 |
point count: 118 |
139 |
|
140 |
|
141 |
- Length and time units |
142 |
You can choose any length related units that are supported by proj4 |
143 |
for attribute table using |
144 |
'--length-unit' (for length column, default: m), |
145 |
'--time-unit' (for time column, default: sec), |
146 |
'--speed-length-unit' (for speed column, default: km), |
147 |
'--speed-time-unit' (for speed column, default: hour) and |
148 |
'--length-ellipsoid' (for length calculation, default: UGS84). |
149 |
You can see the supported units by 'geod -lu' and 'geod -le' command. |
150 |
Supported time unit are 'sec', 'min', 'hour' and 'day'. |
151 |
|
152 |
- Other futures |
153 |
There are other futures in gpx2shp. Please check the option list using |
154 |
|
155 |
gpx2shp --help |
156 |
|
157 |
Problem or Suggestion |
158 |
===================== |
159 |
Please let me know about your opinion in English or Japanese by e-mail. |
160 |
kogame at gmail.com |
161 |
http://gpx2shp.sourceforge.jp/ |
162 |
|
163 |
Acknowledgments |
164 |
=============== |
165 |
NEDA (National Economic and Development Authority) Region IV-B office |
166 |
My generous counter part |
167 |
Yoshio Tanaka |
168 |
My project leader |
169 |
Petter Reinholdtsen |
170 |
Many support to develop this |
171 |
Frank Warmerdam and the team |
172 |
shapelib and proj4 |
173 |
|