I've been trying to use gpsbabel (ver 1.4 on Ubuntu 10.10) to filter some of my tracks prior to uploading, After a few hours experimenting I find that the following script (based on wiki article) works.

1> # test5.sh testing polygon (include)
2> gpsbabel -i gpx -f intest.gpx \
3>        -x transform,wpt=trk,del \
4>        -x polygon,file=d_poly2.txt \
5>        -x transform,trk=wpt,del \
6>        -o gpx -F out_5.gpx

[intest.gpx is a daily file downloaded from my Legend that worked fine in JOSM or gpsprune. d_poly2 is a polygon definition of the area around my house.]

It picks up all points in the polygon or outside if ',exclude' is added.

I first tried to run without lines 3 and 5 (which converts tracks to waypoints and back again - increasing file size with waypoint data : <name>,<cmt> & <desc> tags ) but no filtering at all took place.


I don't understand why the conversion is needed
- or have I got something else wrong ?

Iain



start of intest.gpx

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1"; creator="" version="1.1" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd";>
 <trk>
  <name>ACTIVE LOG080605</name>
  <trkseg>
   <trkpt lat="52.811301" lon="-2.145435">
    <ele>79.543</ele>
    <time>2010-10-04T07:06:04Z</time>
   </trkpt>
   <trkpt lat="52.811294" lon="-2.145414">
    <ele>80.075</ele>
    <time>2010-10-04T07:06:05Z</time>
   </trkpt>


start of out_5.gpx

<?xml version="1.0" encoding="UTF-8"?>
<gpx
  version="1.0"
  creator="GPSBabel - http://www.gpsbabel.org";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xmlns="http://www.topografix.com/GPX/1/0";
  xsi:schemaLocation="http://www.topografix.com/GPX/1/1 
http://www.topografix.com/GPX/1/1/gpx.xsd";>
<time>2010-11-10T21:12:01Z</time>
<bounds minlat="52.807483000" minlon="-2.146208000" maxlat="52.811813000" 
maxlon="-2.123633000"/>
<trk>
<trkseg>
<trkpt lat="52.811301000" lon="-2.145435000">
  <ele>79.543000</ele>
  <time>2010-10-04T07:06:04Z</time>
  <name>WPT001</name>
  <cmt>WPT001</cmt>
  <desc>WPT001</desc>
</trkpt>
<trkpt lat="52.811294000" lon="-2.145414000">
  <ele>80.075000</ele>
  <time>2010-10-04T07:06:05Z</time>
  <name>WPT002</name>
  <cmt>WPT002</cmt>
  <desc>WPT002</desc>
</trkpt>



_______________________________________________
newbies mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/newbies

Reply via email to