Re: [Gpsbabel-misc] OT; GoogleMaps Directions to Waypoint
GPSBabel converts and transfers data like waypoints, tracks & routes.
Brought to you by:
robertl
|
From: Robert L. <rob...@us...> - 2006-09-29 20:26:53
|
> Initially Paul's solution appears to be the turnkey solution I need at = > the moment, (because it's a "2 stepper") but I am not finished trying t= o = Two is too many. IIRC, you're capable of a bit of scripting. getgpxroute austin,tx "1600 pennsylvania avenue, washington, dc" [ time passes ] = <?xml version=3D"1.0" encoding=3D"UTF-8"?> <gpx version=3D"1.1" creator=3D"GPSBabel - http://www.gpsbabel.org" xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" xmlns=3D"http://www.topografix.com/GPX/1/1" xsi:schemaLocation=3D"http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd"> <metadata> <time>2006-09-29T20:20:09Z</time> <bounds minlat=3D"30.264200000" minlon =3D"-97.742760000" maxlat=3D"39.01= 4680000" maxlon=3D"-77.035110000" /> </metadata> <rte> <rtept lat=3D"30.267000000" lon=3D"-97.742760000"> <name>\00000</name> </rtept> <rtept lat=3D"30.264940000" lon=3D"-97.735380000"> <name>\00008</name> </rtept> <rtept lat=3D"30.264410000" lon=3D"-97.735570000"> <name>\00009</name> [ ... continues. The astute observer will actually catch a GPSBabel err= or in there. ] = The idea is simple and can be implement in about any OS and/or scripting environment. My getgpxroute looks like: #!/bin/sh while [ $# -ge 2 ]; do FROM=3D$1 TO=3D$2 # echo "Getting $FROM -> $TO " wget -O - \ "http://maps.google.com/maps?q=3D$FROM to $TO&output=3Djs" > /tmp/gpx= r.$# CMD=3D"$CMD -f /tmp/gpxr.$#" shift done gpsbabel -i google $CMD -x simplify,count=3D250 -o gpx -F - | \ egrep -v '</?rte>' | \ sed -e 's/<bounds.*>/<rte>/' -e 's#</gpx>#</rte></gpx>#' | \ gpsbabel -i gpx -f - -x simplify,count=3D450 -o gpx,gpxver=3D1.1 -F - This is actually more complicated than most such scripts becuase it's all= ows for multiple stops to be passed on the command line but the ultimate cons= umer of this data gets all confused about the multiple segments that we genera= ted above. If the reader was smarter and you didn't need to be able to intr= oduce interim stops it could be a one-liner. |