I started to play around with my Garmin Nuvi GPS today. Like most GPSs you can add custom Points Of Interest by creating special CSV files. Depending on how you create and name the CSV file you can create automatic warnings if you are speeding, or approaching an intersection that's equipped with a red light camera.
So I started browsing the web and found a site that offers the information to you in CSV format
if you subscribe. Well, seeing they still give you all the relevant information, just not in a convenent format, I created this script to do the converting for me:
Code:
#!/bin/sh
if [ -e "redlight.csv" ]
then
rm redlight.csv
fi
for file in *
do
if [ -f "$file" ]
then
awk -F\( '/setLocation\(/ { print $2 }' "$file"|awk -F\) '{ print $1 }'|awk -F\&\; '{ print $1 "&" $2 }' |awk -F\' '{ print $1 $2 }' |awk -F\, '{ print $2 ", " $1 ", " $3 >> "redlight.csv" }'
fi
done
To use this, you simply go to the site linked above, browse to the city you're interested in, and save the page onto your computer. You can repeat this for as many cities as you like, just so long as you save all the data into one directory. Then in a shell, browse to that directory and run the script. In one clean swoop, you have your fancy new CSV file.
