The Revolution Will Be Geotagged

Over the weekend I’ve been working on a Python for Series 60 project that I thought up a few days ago while exchanging information with Gustaf between Google Earth instances. It really should have hit me when Google Sightseeing packed its sights in to a KML file, but what can I say, I’m a little slow.

After sending a .kml file via email to Gustaf, I decided to take a look at what exactly made up a .kml file. I started to drool a little bit when I read the KML documentation. The first example is extremely simple yet there’s a lot of power behind it. A few lines of XML can tell Google Earth exactly where to look and what to look at.

Proof of Concept

With this simple example in mind, I started to prototype out a proof of concept style Python app for my phone. Right now everything is handled in a popup dialog, and for the time being I’m just going to save a .kml file and let you do with it as you please, but over the next few days I plan to re-implement the app with an appuifw.Form, get latitude and longitude information from Bluetooth GPS (if you’re so lucky), and work on smtplib integration so that the app can go from location -> write KML -> send via smtplib.

Rapid Mobile Development

When I say that I’ve been working on this app over the weekend, that’s not strictly accurate. I prototyped the proof of concept over about 20-30 minutes on Friday night using the Python for Series 60 compatability library from the wonderful folks at PDIS. I then spent the rest of some free time over the weekend abstracting out the KML bits and reverting my lofty smtplib goals to saving to a local file on the phone. I’m not sure if the problem is due to my limited T-Mobile access or if I need to patch smtplib in order to use it on my phone.

There’s also one big downside to trying to use smtplib on the phone, and that’s the fact that smtplib (and gobs of dependent modules) aren’t distributed with the official Nokia PyS60 distribution, so if I’m going to distribute this app with smtplib functionality, I’ll have to package up a dozen or two library modules to go with it. I’m going to mull it over for a few days and see if I can get past my smtplib bug or investigate alternatives.

from kml import Placemark

I’ve started a rudimentary Python kml library designed with the Series 60 target in mind. It’s rather simplistic, and so far I’ve only implemented the simplest of Placemarks, but I plan to add to it as the need arises. It should be quite usable to generate your own KML Placemark. Here’s a quick usage example:

>>> from kml import Placemark
>>> p=Placemark(39.28419, -76.62169, 
"The O's Play Here!", "Oriole Park at Camden Yards")
>>> print p.to_string()
<kml xmlns="http://earth.google.com/kml/2.0">
<Placemark>
  <description>The O's Play Here!</description>
  <LookAt>
    <longitude>-76.62169</longitude>
    <latitude>39.28419</latitude>
    <range>600</range>
    <tilt>0</tilt>
    <heading>0</heading>
  </LookAt>
  <Point>
    <coordinates>-76.62169,39.28419</coordinates>
  </Point>
</Placemark>
</kml>

Once I have my Placemark object, saving to disk is cake:

>>> f=open("camdenyards.kml", "w")
>>> f.write(p.to_string())
>>> f.close()

If you have Google Earth installed, a simple double click should bring you to Camden Yards in Baltimore. The simplicity of it and the “just works” factor intrigue me, not the fact that this can be accomplished in a few dozen lines of python but the fact that KML seems so well suited for geographic data interchange.

Camden Yards in Google Earth

It’s About Interchange

If you are really in to geographic data, and I mean so at an academic or scientific level, KML probably isn’t the format for you. You might be more interested in the Open Geospatial Consortium’s GML (Geography Markup Language). It looks like it does a great job at what it does, but I’m thinking that the killer format is aimed more at the casual user. KML is just that. From a simple Placemark describing a dot on a map to complicated imagery overlays, KML has your back covered. I find the documentation satisfying and straighforward, though I’m no expert on standards.

In the very near future conveying where you are or what you are talking about in a standard way is going to be extremely important. Right now there’s only one major consumer of .kml files and that’s Google Earth. Expect that to change rapidly as people realize how easy it is to produce and consume geodata using KML and .kmz files (which are compressed .kml files that may also include custom imagery).

I would love to see “proper” KML generators and consumers, written with XML toolkits instead of throwing numbers and strings around in Python. I would love to have a GPS-enabled phone spitting out KML using JSR-179, the Location API for J2ME. I hope to use Python for Series 60 to further prototype an application that uses a Bluetooth GPS receiver for location information and allow easy sharing of geodata using KML.

The Code

If you’d like, take a look at the current state my kml Python library, which is extremely simple and naive, but it allows me to generate markup on either my laptop or N-Gage that Google Earth is happy to properly parse. A proof of concept wrapper around this library can be found here. I hope to expand both in the coming days, and I hope to soon have the smtplib-based code working properly on my phone with my carrier.

Update: Oops, forgot to add the <name/> tag. Fixed. The name should now replace the (ugly) filename for your Placemark.

34 Responses to “The Revolution Will Be Geotagged”


  1. 1 Matt Croydon Aug 2nd, 2005 at 3:07 pm

    Just a test.

  2. 2 Joe Random User Aug 2nd, 2005 at 3:08 pm

    Another test.

  3. 3 Eric Moritz Aug 4th, 2005 at 12:07 pm

    ooo, I look forward to getting my hands on a gps enabled phone for when I go kayaking around Naples

  4. 4 Carl Reed Aug 25th, 2005 at 11:16 am

    Enjoyed the read. WRT GML, perhaps check out Ron Lake’s new blog http://geoweb.blog.com/ in which he speaks to a variety of uses for GML - simple profiles, easy to implement and oriented more towards “consumer” applications than for the “geo-geek”. Also check out another site www.georss.org in which a very simple profile of GML is proposed for web feeds (RSS2.0 or ATOM).

    Regards

  5. 5 Matt Croydon Aug 25th, 2005 at 11:23 am

    Hey thanks so much for the links Carl! It looks like I have some reading to do.

  6. 6 N888 - betterdifferent.com Aug 27th, 2005 at 10:22 am

    Matt! I have been dreaming of a friend-to-friend fully distributed wiki (see http://evolvethis.com/superwiki) bank of “pictures” that include GPS location, heading, etc, WITH A SOUND CLIP automatically e-mailed to a contact group from my 6600… add a wide angle mirror and multiple phones (angles) sending to the same place and we get toward birtual reality, see http://evolvethis.com — see my video moblog: http://nate.textamerica.com PEACE :-) N888 — emancipated, “no-owner sharing” content shared by :: THE N888 SHOW:: color, copy & remix!

  7. 7 Ron Lake Sep 7th, 2005 at 12:01 am

    Your dream of a bank of pictures that “that include GPS location, heading, etc” is why GML Observation was created. See the section on Observations in GML at http://geoweb.blog.com.

  8. 8 asdf Apr 16th, 2008 at 6:27 am

    AGGRESS AutoPost Test

  9. 9 Good Apr 16th, 2008 at 9:17 am
  10. 10 Atnas May 9th, 2008 at 2:44 am
  11. 11 Prolan Aug 5th, 2008 at 7:45 am

    Smj3je re re re
    GAV GAV

  12. 12 Vasyu Aug 8th, 2008 at 12:43 pm

    BBOAfG Vasyu testit vasyu.net

  13. 13 Трезвый водитель Aug 18th, 2008 at 5:33 pm

    Трезвый водитель, 1500 руб, за 2 часа работы.
    Механика и автомат не проблема

  14. 14 Трезвый водитель Aug 18th, 2008 at 5:53 pm

    Трезвый водитель 1500 руб за 2 часа работы.
    механика и автомат не проблема.
    http://unidriver.narod.ru

  15. 15 Indian Drugs Oct 4th, 2009 at 2:53 pm

    Tnx for the info, but Python really sucks as the programming language :(

  16. 16 BaKiNeC Jan 15th, 2010 at 4:18 pm

    Даа… После прочтения даже РјРЅРµ тема стала интересна.

  1. 1 High Earth Orbit » Blog Archive » Better Location uploading from a cellphone Pingback on Aug 3rd, 2005 at 1:31 pm
  2. 2 Kristina Serebrink Trackback on Dec 1st, 2005 at 4:25 pm
  3. 3 Sara Ruritz Trackback on Dec 9th, 2005 at 6:30 am
  4. 4 Kim Nymanson Trackback on Dec 9th, 2005 at 8:12 am
  5. 5 Sotia Iwar Trackback on Mar 8th, 2006 at 10:17 pm
  6. 6 Bevnhara Sinre Trackback on Mar 8th, 2006 at 11:22 pm
  7. 7 Frida Nilsson Trackback on Mar 8th, 2006 at 11:48 pm
  8. 8 Sandy Gerstienberg Trackback on Mar 9th, 2006 at 1:05 am
  9. 9 Laura Ammara Trackback on Jun 16th, 2006 at 1:11 am
  10. 10 gps data logger Trackback on Jun 29th, 2007 at 7:31 am
  11. 11 Kimberly Smith Trackback on Jul 12th, 2007 at 10:05 pm
  12. 12 gps data logger Trackback on Feb 13th, 2008 at 12:36 pm
  13. 13 gps logger Trackback on Feb 19th, 2008 at 12:25 am
  14. 14 aspire credit card application application aspire card credit Trackback on Apr 1st, 2008 at 10:58 pm
  15. 15 roulette trick Trackback on Apr 2nd, 2008 at 12:03 pm
  16. 16 citibank advantage credit card citibank credit card philippine Trackback on Apr 2nd, 2008 at 12:56 pm
  17. 17 credit card balance transfer offer Trackback on Apr 2nd, 2008 at 9:29 pm
  18. 18 alltel free music ringtones alltel free real ringtones Trackback on Apr 18th, 2008 at 12:46 pm

Leave a Reply