[Xastir] Missing dependency for gpx2shape

Tom Russo russo at bogodyn.org
Mon Mar 21 20:03:14 EDT 2016


On Mon, Mar 21, 2016 at 07:40:07PM -0400, we recorded a bogon-computron collision of the <eric at christensenplace.us> flavor, containing:
> 
> > You may be better off using gdal tools to convert gpx files to shapefiles.  
> > They are extremely powerful and are under constant development.
> > 
> > The tool to use for this would be "ogr2ogr", which can convert any vector
> > format that GDAL supports to any other format that GDAL supports.  GPX and
> > Shapefile are among those.  
> 
> I installed GDAL but I can't seem to figure out how to make the ogr2ogr
> script to work (and the documentation is minimal).  I didn't realize it
> was going to be so difficult to get a GPX track to show up in Xastir!
> *sigh*

ogr2ogf -f "ESRI Shapefile" <output directory> input.gpx

will create a directory of shapefile pieces from the input.gpx file.

This is necessary because the GPX file can have more than one "layer",
e.g. track points, track lines, route points, route lines, and waypoints.
Done this way, the directory will contain a separate shapefile for each of those
layers.

There are ways of telling it to take only one layer, but I don't recall the
command line options off the top of my head.

You can do 
    ogrinfo -so -al input.gpx

to list all the layers in the input file.  Then you'd give ogr2ogr the
right command line option to extract just the one layer.  I just checked
the man page, and the way you do that is:
   ogr2ogr -f "ESRI Shapefile" output.shp input.gpx <layername>


-- 
Tom Russo    KM5VY   SAR502   DM64ux          http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236        http://kevan.org/brain.cgi?DDTNM
 echo "prpv_a'rfg_cnf_har_cvcr" | sed -e 's/_/ /g' | tr [a-m][n-z] [n-z][a-m]

 




More information about the Xastir mailing list