3/16/2008

Mail-to-GE; Mail-to-Map service

Eugene Potapov

View Larger Map

View in Google Earth
Mail to Map/SMS-to-Map/Mail to GE service: new twist in (r)Evolution

The idea of creating a simple “Mail-to-Map” service came when I was tracking White-Tailed Deer in the suburbs of Pennsylvania. The GPS coordinates were send by the collared deer as a SMS/Text Message via GSM/cell-phone networks to a server in Sweden, and then relayed to my e-mail account. I was surprised to find out that there was no way for me to gain access to the server, so the creation of dynamic kml/kmz files straight from the server was out of the question. All what I was left with was a set of e-mails with 8 coordinates in each.

Here is my first attempt for a solution, which reads coordinates in e-mail and relays coordinates in real-time to the Google-Earth/Google Map service. I believe this is the fist successful solution of Mail-to-Map service which is based entirely on free web services. Let me know, if it is not correct.

Important notice: since the displayed coordinates belongs to a live animal (currently a white-tailed Deer nicknamed Thor), by reading this page and looking at the map you are accepting terms of agreement: “do not harm the animal in anyway’. Actually it lives on private grounds or a preserve territory anyway.

So, if you want to see the resulting dynamic map, skip this section and click at the map links or download the kml file.

If you are interested in details, here they are.

1. Set up a blog dedicated exclusively to ‘mail-to-map’ service. There are number of possibilities for doing that. For this project I used http://u-mail-to-map.blogspot.com/ Be sure that the blog is set for only for you to edit.
2. Set up e-mail address within blog setting, so that you can e-mail the data to the blog. Use this e-mail address for the step 3.
3. Set automatic mail forward to the e-mail address set in the step 2. I use g-mail account with associated filters to forward only messages referred to particular collar (individual) number.
4. set up a spread-sheet in google-documents and link the blog to the spreadsheets. I use command “=importxml("http://u-mail-to-map.blogspot.com/","//p[1]/text()")”. The resulting spreadsheet is here: http://spreadsheets.google.com/pub?key=pb-UYBP_92h9qQKwbVy07Zg&gid=0
5. Consult google-spreadsheet documentation how to filter/sort the location, and this posts ( http://bbs.keyhole.com/ubb/showflat.php?Number=725524 ; http://bbs.keyhole.com/ubb/showthreaded.php/Cat/0/Number/550183 ) how to construct kml files from the spreadsheets. Mind, that if the coordinates are ‘blank’, the google-maps/google-earth service will treat such locations as ‘syntax error”. In my spread-sheets I corrected “GPS timeouts” by substituting “blanks” with average locations for entire sms message (8 gps fixes).
6. Now link the kml portion of the spreadsheet (http://spreadsheets.google.com/pub?key=pb-UYBP_92h9qQKwbVy07Zg&gid=4&output=txt&range=Q2) to google maps (example here), and create “Network link” as advised in this post (). The resulting KML file is here. Do not forget to “publish” the spreadsheet, and tick the widnow “Automatically re-publish when changes are made”. The address “pb-UYBP_92h9qQKwbVy07Zg” is unique for your spreadsheet.
7. Now, important notice about refresh rates. In my example the coordinated arrive via email every 40 min, blog is updated almost instantly, spreadsheets are updated/re-published c. every 5 mins, but I have notice that it may be as long as 20 mins on some occasions. So it is prudent to set refresh rate to 20-40 min in the network link, so it will deliver the up-to-date coordinates.
8. For web-pages and imbedded iframe links: it is important to set “No-cache” options, and refresh rates. I used all possible solutions to make the web page browser independent:
meta equiv="CACHE-CONTROL" content="NO-CACHE"
meta equiv="PRAGMA" content="NO-CACHE"
meta equiv="Expires" content="0"
The last tag was instrumental to tame IE.
Refresh rate was set to 900 sec by the command
meta equiv="Refresh" content="900"
Failure to set auto-refresh and no-cache options will result in displaying out-of-date locations.
Important is to center the map on your coordinates. I achieve it my pointing g-maps to get ll from the cell in my spreadsheet: “ll=http://spreadsheets.google.com/pub?key=pb-UYBP_92h9qQKwbVy07Zg&gid=1&output=txt&range=G2”.

The resulting Google-Map is here http://www.potapov-nature.com/forBA/deer/map4.html , and kml file (network link) for Google-Earth is here.
A block diagram of the totally free web based Mail-to-Map service is below.

Potentially such simple Mail-to-Map solution can be used for a variety of applications such as satellite telemetry, fleet monitoring, iphone coordinates display, sms-to-map service, etc.
Post a Comment