In preparation for my Arizona jaunt to watch the May 20thannular eclipse I spent a few hours on Google Maps selecting locations to visit. Here are my prime targets.
After selecting targets the next step is to load them onto my “GPS device.” Currently my GPS device is the MotionX GPS iPhone app. MotionX can read GPX files in many ways but you need GPX files not Google Maps KML files. Converting KML to GPX is a recurring nuisance. I’ve used online converters for this chore but today, after being annoyed by this problem for the zillionth time, I dashed off a J script that transforms Google Maps KML to GPX. The main verb gpxfrmapkml is shown below. The entire script is available here. Happy KML to GPX’ing my friends.
gpxfrmapkml=:3 : 0NB.*gpxfrmapkml v-- gpx from Google maps kml.NB.NB. monad: clGpx =. gpxfrmapkml clKmlNB.NB. NB. download Google map waypoints as kmlNB. kml=. read 'c:/temp/arizona annular eclipse.kml'NB.NB. NB. convert to gpx and saveNB. gpx=. gpxfrmapkml kmlNB. gpx write 'c:/temp/arizona annular eclipse.gpx' NB. parse kml form waypoint tabledname=.;'name'geteletext'<Placemark>'beforestrywpt=.;'Placemark'geteletextywpt=.('name'geteletextwpt),.<;._1&>','&,&.>'coordinates'geteletextwpthdr=.;:'phototitle longitude latitude'NB. format gpx header gpxstamp=.'Waypoints: ',(":#wpt),' GPX generated: ',timestamp''gpxheader=.('/{{headername}}/',dname,'/{{headerdescription}}/',gpxstamp)changestrGPXFRKMLHEADERgpxtrailer=.GPXTRAILER'idx pkml'=.HTMLVARBPATTERNpatpartstrGPXSMUGPLACEMARKrvarbs=.idxhtmlvarbspkmlNB. all row varibles must exist in data headerassert.*./rvarbse.hdrrows=.(#wpt)#,:pkmlrows=.((hdri.<'phototitle'){"1wpt)(<a:;(rvarbsi.<'phototitle'){idx)}rowsrows=.((hdri.<'latitude'){"1wpt)(<a:;(rvarbsi.<'latitude'){idx)}rowsrows=.((hdri.<'longitude'){"1wpt)(<a:;(rvarbsi.<'longitude'){idx)}rowsgpxheader,(;rows),gpxtrailer)