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.
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.
Comments
113 responses to “The Revolution Will Be Geotagged”
Just a test.
Another test.
[…] Matt Croydon spent the past weekend pulling apart KML, the Keyhole Markup Language which Google uses in their newly acquired/developed GoogleEarth […]
ooo, I look forward to getting my hands on a gps enabled phone for when I go kayaking around Naples
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 http://www.georss.org in which a very simple profile of GML is proposed for web feeds (RSS2.0 or ATOM).
Regards
Hey thanks so much for the links Carl! It looks like I have some reading to do.
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!
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.
LOOK AT THIS LINK
Matt Croydon::Postneo …
com kapook music
Matt Croydon::Postneo …
download detective conan mp3 truth song
Matt Croydon::Postneo …
lesbian-camel-fuck…
Matt Croydon::Postneo ……
lesbian-animal-fuckers…
Matt Croydon::Postneo ……
lesbian-freepics…
Matt Croydon::Postneo ……
large-penis-in-vagina…
Matt Croydon::Postneo ……
spanky-and-our-gang…
Matt Croydon::Postneo ……
gps data logger…
Hi. Thanks for the good read….
Kimberly Smith…
I Googled for something completely different, but found your page…and have to say thanks. nice read….
gps data logger…
Yes indeed….
gps logger…
It is small and inexpensive, but offers up all sorts of options that will meet your navigation needs with amazingly great power. This unit is unique and convenient as it has a click to enter scroll wheel making it easy to select your destinations….
application card credit form visa…
…
multi roulette…
…
ringtones for verizon wireless get it now verizon get it now ringtones…
…
bank card credit first premier bank card credit first premier secured…
…
AGGRESS AutoPost Test
http://Good.com
creator free ringtones software…
…
http://fisting3.by.ru
Smj3je re re re
GAV GAV
BBOAfG Vasyu testit vasyu.net
Òðåçâûé âîäèòåëü, 1500 ðóá, çà 2 ÷àñà ðàáîòû.
Ìåõàíèêà è àâòîìàò íå ïðîáëåìà
Òðåçâûé âîäèòåëü 1500 ðóá çà 2 ÷àñà ðàáîòû.
ìåõàíèêà è àâòîìàò íå ïðîáëåìà.
http://unidriver.narod.ru
Tnx for the info, but Python really sucks as the programming language 🙁
Даа… ПоÑле Ð¿Ñ€Ð¾Ñ‡Ñ‚ÐµÐ½Ð¸Ñ Ð´Ð°Ð¶Ðµ мне тема Ñтала интереÑна.
When I look at your RSS feed it throws up a ton of unformatted html, is the malfunction on my side?
Just thought I would comment and say awesome theme, did you create it yourself? It looks excellent!
Thank you for the helpful info! I wouldn’t have gotten this by myself!
Just one word to describe this blog… super. Keep up the brilliant articles!
Wow! Thank you! I continuously needed to write on my website something like that. Can I implement a fragment of your post to my website?
Santa Clause is coming, you shouls top writing and have a good time with your family. Happy new year
I’m still learning from you, but I’m making my way to the top as well. I certainly liked reading all that is written on your website.Keep the stories coming. I enjoyed it
You made a number of fine points there. I did a search on the issue and found a good number of persons will consent with your blog.
You made various good points there. I did a search on the matter and found a good number of people will go along with with your blog.
You made a few good points there. I did a search on the subject and found a good number of people will go along with with your blog.
You are a very intelligent individual!
It is a pity, that now I can not express – it is compelled to leave. I will be released – I will necessarily express the opinion.
As a Newbie, I am constantly browsing online for articles that can be of assistance to me. Thank you
Thank you for making the sincere attempt to give an explanation for this. I believe very robust approximately it and want to be told more. If it’s OK, as you attain more extensive knowledge, may you thoughts including more posts very similar to this one with additional information? It might be extraordinarily helpful and useful for me and my colleagues.
Strange this publish is totaly unrelated to what I used to be looking out google for, but it was indexed at the first page. I guess your doing one thing right if Google likes you sufficient to put you on the first web page of a non comparable search.
This was really an attention-grabbing matter, I’m very lucky to have the ability to come to your blog and I will bookmark this page so that I could come back another time.