Converting GPS coordinates to a TomTom format |Solved|

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
chapchap70
Posts: 210
Joined: Thu 18 Nov 2010, 05:39
Location: The Island Of Long (NY, USA)

Converting GPS coordinates to a TomTom format |Solved|

#1 Post 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
Last edited by chapchap70 on Wed 26 Nov 2014, 21:56, edited 1 time in total.

User avatar
LazY Puppy
Posts: 1934
Joined: Fri 21 Nov 2014, 18:14
Location: Germany

#2 Post 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
RSH

"you only wanted to work your Puppies in German", "you are a separatist in that you want Germany to secede from Europe" (musher0) :lol:

No, but I gave my old drum kit away for free to a music store collecting instruments for refugees! :wink:

chapchap70
Posts: 210
Joined: Thu 18 Nov 2010, 05:39
Location: The Island Of Long (NY, USA)

#3 Post 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:

chapchap70
Posts: 210
Joined: Thu 18 Nov 2010, 05:39
Location: The Island Of Long (NY, USA)

Found This!

#4 Post 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/

Post Reply