finally (!) the gps coordinates conversion script is working. I only need it for my earlier gps files as I used to save them as .txt files rather than .gpx files (& .txt) - not sure why. I mustn't have realised there was a .gpx format when I first bought the gps (Garmin e-trex) or that I might need it one day. anyway.. I cheated a little by preparing the files first and removing the degrees & minutes control characters so the script doesn't have to process them. as I didn't know the correct values - maybe I'll sort this out for a later version, but by then I'll have probably converted all the data to .gpx and won't need to use the script anymore.
currently I'm just building < trk > tags, not the waypoints - I don't use the waypoints often, just the tracks - at least in the gps drawings.
this is what the gpx file needs to look like :
this is what the original txt file looks like :
the problem is that the format of the coordinates needs to be converted. in the original txt file, they're written as : N38‚àû51.1373' W094‚àû48.2065' ie :
direction letter=N
degrees=38
degrees symbol=‚àû
minutes in MM.MMMM=51.1373
minutes symbol='
but the gpx file needs to have them in +/- degrees.minutes format
eg : lat="-36.84994166666666666666" lon="174.76046833333333333333"
so to calculate this, you need to calculate this formula for latitude & longitude & print the +/- for the direction (N=+, S=-) the + is optional, but if the direction is South, you need the - minus sign :
gpx lat/lon format coordinates = degrees + (MM.MMMM / 60)
I had problems removing the degrees symbol & minutes symbol in the script
so, to cheat, I made a new file called gpscoords.txt, and remove the degrees and minutes symbols / control characters, replacing them with spaces :
then it's a few easy cut commands and doing the maths formula & then building the gpx file xml tags structure to create the final gpx file ie run the txt2gpx.sh script
txt2gpx_v01_20090321.sh 20050224_home-stainesx2-2.txt
ie command gpscoordinatesfile.txt
then I rename this and load it into http://www.gpsvisualizer.com and select JPEG image and it creates a line drawing of the tracks. there are other options eg to overlay over google maps / earth etc
then save the image & it's url and add it to the blog entry
and here's some example gps track drawings :
20050224_work-home-part1
gps drawing - drive from work to home in UK - chandlers ford to shirley.
24/02/2005
20050224_work-home-part3
gps drawing - drive from work to home in UK - chandlers ford to shirley.
24/02/2005
20050224_home-stainesx2-2.txt
gps drawing of a drive from Southampton (Shirley) to Staines & back again
google maps version (saved image) :
drive to rotorua 29-31/07/2005
drive to rotorua 29-31/07/2005 - google earth version
Attachment | Size |
---|---|
20050224_work-home-part1.gpx | 3.4 KB |
20050224_work-home-part1.txt | 1.95 KB |
20050224_work-home-part1.jpg | 8.97 KB |
txt2gpx_v01_20090321.sh | 2.54 KB |