PDA

View Full Version : Selecting POI's along a route



OffTrack
12th August 2013, 10:05 AM
This is a bit geeky but could possibly be of use to someone. ;)

We are planning a two week holiday and my partner has used frequent flyer points to buy a couple of BP gift cards so it's useful to know where we can actually use them.

It is possible to download the gps locations of service stations from the BP website BUT you can only do this on a state by state basis. Our trip traverses three states and the downloaded file of BP service stations contains 856 waypoints. Not especially helpful :angel:

The solution turned out to be relatively easy, and is documented in various places including the GPSBabel website - Include Only Points Within Distance of Arc (arc) (http://www.gpsbabel.org/htmldoc-development/filter_arc.html)

The essential tool for doing this is GPSBabel - GPSBabel: convert, upload, download data from GPS and Map programs (http://www.gpsbabel.org)
It's free and is used as the basis of many of the free waypoint conversion websites, but you really need access to the commandline version to do the necessary magic as the GUI (on OSX at least) doesn't give access to the options needed.

As a starting point you need:
- a gps route
- a file of POI waypoints
- GPSBabel


The first step is to convert the route from gpx, kml or other format to a gpsbabel ARC format. The ARC format is simply a list of gps co-ordinates.
The conversion is straight forward with the GPSBabel front end:
http://www.aulro.com/afvb/attachment.php?attachmentid=64112&d=1376266215

and results in a file that has contents looking like this:


-37.73288 144.91275
-37.73561 144.90372
-37.73375 144.88413
-37.72333 144.84317
-37.71506 144.83502
-37.70850 144.82092
-37.67076 144.76251
-37.65965 144.74206

The .csv file from the BP site can't be used as is, but only needs some minor tweakage. The file has the following header which GPSBabel doesn't understand.


displayname latitude longitude


By using the universal csv format (http://www.gpsbabel.org/htmldoc-development/fmt_unicsv.html) we can rectify this problem easily by changing the column names to be GPSBabel friendly.


name lat lon

Once this is done it's simple to convert to GPX format by selecting Universal CSV as the input format.

http://www.aulro.com/afvb/attachment.php?attachmentid=64117&stc=1&d=1376267494

Once the file is loaded up, it's obvious that this is too much information ;)

http://www.aulro.com/afvb/attachment.php?attachmentid=64118&stc=1&d=1376267833

At this point the GPSBabel GUI is no help, so it's time to fire up the Terminal.

I used the following command:


gpsbabel -i gpx -f /Users/offtrack/Desktop/BP_GPS_list.gpx -x arc,file=/Users/offtrack/Desktop/Melb2Morg.txt,distance=1K -o gpx -F /Users/offtrack/Desktop/BP_1K_off_route.gpx

-i = input format (gpx)
-f = the file you want to filter, the BP waypoints.
-x specifies the filtering information: arc filter, input file, and the maximum distance from the arc (aka route) in this case 1 km.
-o = output format (gpx)
-F = output filename

The result looks like this, which is much more manageable.

http://www.aulro.com/afvb/attachment.php?attachmentid=64120&stc=1&d=1376268995

Obviously this technique can be applied to any list of waypoints or POI's, and is quite simple once you've done it a couple of times.

cheers
Paul