Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 28 Apr 2015, 01:43
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Converting GPS coordinates to a TomTom format |Solved|
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [4 Posts]  
Author Message
chapchap70

Joined: 18 Nov 2010
Posts: 151
Location: The Island Of Long (NY, USA)

PostPosted: Tue 25 Nov 2014, 23:27    Post subject:  Converting GPS coordinates to a TomTom format |Solved|  

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:

Quote:
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, 17:56; edited 1 time in total
Back to top
View user's profile Send private message 
LazY Puppy


Joined: 21 Nov 2014
Posts: 443
Location: Germany

PostPosted: Wed 26 Nov 2014, 03:51    Post subject:  

I assume you know how to make a script.
Code:
#!/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:
-738317032|407820015|
Just read out your file in a loop using the code above:
Code:

while read LINE;
do

 above code modified for your output purposes

done < original_data_file_here

_________________
RSH
No Smart-Phones, no FaceBook, no Twitter etc...
but: LazY Puppy!
Copyright is NOT Copyleft: good people are aware of this and respect both of them!
Back to top
View user's profile Send private message 
chapchap70

Joined: 18 Nov 2010
Posts: 151
Location: The Island Of Long (NY, USA)

PostPosted: Wed 26 Nov 2014, 18:23    Post subject:  

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. Laughing
Back to top
View user's profile Send private message 
chapchap70

Joined: 18 Nov 2010
Posts: 151
Location: The Island Of Long (NY, USA)

PostPosted: Sun 30 Nov 2014, 22:01    Post subject:  Found This!  

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/
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [4 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0717s ][ Queries: 11 (0.0259s) ][ GZIP on ]