Page 1 of 1

Converting GPS coordinates to a TomTom format |Solved|

Posted: Wed 26 Nov 2014, 03:27
by chapchap70
I make 20 plus deliveries per day in my job and use a TomTom XL with itinerary files. Since TomTom is linux based, I can open and read the *.itn files.

I am trying http://www.gpsvisualizer.com//geocoder/ to geocode waypoints because I think this could be a quicker way than manually entering all the addresses.

The coordinates output into standard decimal latitude and longitude readings. Random examples:
40.7820015|-73.8317032|New York, NY|New York, NY||Bing Maps|city/town
39.1071281|-84.5041275|Cincinnati, OH|Cincinnati, OH||Bing Maps|city/town
42.3586617|-71.0567398|Boston, MA|Boston, MA||Bing Maps|city/town
38.8903694|-77.0319595|Washington DC|Washington, DC||Bing Maps|city/town
GPS converters like GPS Babel don't seem to be able to convert the coordinates into TomTom *.itn files.

TomTom uses 7 intergers, swaps the latitude and longitude and removes the decimal points. If I copy and paste the following into the temporary.iti file, it would route me to New York, NY

-7383170|4078200|

Is there a spreadsheet command or some other way to automatically switch the standard coordinate format into this one? I couldn't even figure out how to remove the decimal points.

Thanks

Posted: Wed 26 Nov 2014, 07:51
by LazY Puppy
I assume you know how to make a script.

Code: Select all

#!/bin/sh
Original="40.7820015|-73.8317032|New York, NY|New York, NY||Bing Maps|city/town"

DOTOUT="\."
RET1=$(echo $Original|cut -d'|' -f1)
RET2=$(echo $Original|cut -d'|' -f2)
echo $RET1
echo $RET2
echo $RET1 >/tmp/ret1
echo $RET2 >/tmp/ret2
sed -i 's|'"$DOTOUT"'|''|' /tmp/ret1
sed -i 's|'"$DOTOUT"'|''|' /tmp/ret2
read RET1NEW < /tmp/ret1
read RET2NEW < /tmp/ret2

echo $RET1NEW
echo $RET2NEW

echo -n $RET2NEW > /tmp/output_new_refined
echo -n "|" >> /tmp/output_new_refined
echo -n $RET1NEW >> /tmp/output_new_refined
echo "|" >> /tmp/output_new_refined  # output a new line after this
Output of above example:

Code: Select all

-738317032|407820015|
Just read out your file in a loop using the code above:

Code: Select all

while read LINE;
do

 above code modified for your output purposes

done < original_data_file_here

Posted: Wed 26 Nov 2014, 22:23
by chapchap70
Thanks LazY Puppy, that couldn't be better!

I will delve into this over our Thanksgiving holiday to see what else I can make the script do.

By the way, if you come across the pond, don't use those coordinates if you want to get to Manhattan. Those coordinates will get you into a parking lot in Queens; by 20th St if I remember correctly. :lol:

Found This!

Posted: Mon 01 Dec 2014, 02:01
by chapchap70
For those interested, I found this site that uses google maps to geocode latitude and longitude. It is capable of exporting the waypoints to my TomTom after calculating the fastest route. This does a better job with the data I get from work (it isn't clean) and geocodes with fewer errors.

The code is available for viewing and modification to anyone's specific use and is at the link below.

http://optimap.net/