| 1 |
<para> |
| 2 |
This filter is designed to solve advanced problems that involve shuffling |
| 3 |
multiple lists of waypoints, tracks, or routes. |
| 4 |
</para> |
| 5 |
<para> |
| 6 |
The stack filter can be used to save the current state of the entire |
| 7 |
collection of data. That state is placed on top of a stack of collections, |
| 8 |
so you can simultaneously have as many stored collections of data as you |
| 9 |
can fit in your computer's memory. |
| 10 |
</para> |
| 11 |
<para> |
| 12 |
The stack filter can be used in conjunction with other |
| 13 |
filters to implement a "union" or "logical or" functionality. |
| 14 |
The basic idea is to use the stack to store copies of the |
| 15 |
original list of waypoints, then use the 'swap' function to |
| 16 |
replace each copy with a filtered list. Finally, append all |
| 17 |
of the filtered lists to create one big list, which is then |
| 18 |
output. The following example finds a list of all points |
| 19 |
that are either inside county A or inside county B. Any |
| 20 |
points that are inside both counties are duplicated (but the |
| 21 |
duplicates can be removed with the DUPLICATE filter; see |
| 22 |
above.) |
| 23 |
</para> |
| 24 |
<para><userinput> |
| 25 |
gpsbabel -i gpx -f in.gpx |
| 26 |
-x stack,push,copy |
| 27 |
-x polygon,file=county_a.txt |
| 28 |
-x stack,swap |
| 29 |
-x polygon,file=county_b.txt |
| 30 |
-x stack,pop,append |
| 31 |
-o gpx -F out.gpx |
| 32 |
</userinput></para> |
| 33 |
<para> This example reads a large list of waypoints and |
| 34 |
extracts the points within 20 miles of each of two cities, |
| 35 |
writing the waypoint descriptions into two different PalmDoc |
| 36 |
files and exporting all of the points to the GPS receiver: |
| 37 |
</para> |
| 38 |
<para><userinput> |
| 39 |
gpsbabel -i gpx -f indiana.gpx |
| 40 |
-x stack,push,copy |
| 41 |
-x radius,lat=41.0765,lon=-85.1365,distance=20m |
| 42 |
-o palmdoc,dbname=Fort\ Wayne -F fortwayne.pdb |
| 43 |
-x stack,swap |
| 44 |
-x radius,lat=39.7733,lon=-86.1433,distance=20m |
| 45 |
-o palmdoc,dbname=Indianapolis -F indianapolis.pdb |
| 46 |
-x stack,pop,append |
| 47 |
-o magellan -F fwaind.wpt |
| 48 |
</userinput></para> |