Monday, 14 June 2010
I've been having a totally Python-tastic weekend. Rode up to Dartmoor over the weekend. First time using 'Mapping Tool' - on a Palm Pixi.
Mapping Tool has a super-slick feature, it lets you select CycleMap from openstreetmap.org as the renderer, and it will show you all the national cycle routes. It also has another feature, which is less than cool. If you want to export a gps track, you do it via email, or multiple emails if you track is deemed to large. Our trip to Dartmoor warranted 10 emails - the Pixi gives up after 4 or 5.
I decided to get the gpx files off the phone myself, like I used to do with TMJ (Track My Journey). What I found were hidden directories with SQLite databases, three in total. I have about 6 tracks on the Pixi at the moment, so I couldn't work out why only 3.
I've never touched databases in Python. C, Objective-C, Java, Perl, Ruby - yes, but not Python. The road seemed to rise to meet me again, and I quickly had the data out of the database - and worked out that all my tracks were in one of the databases - with differing IDs.
Next was creating GPX style XML. Parsing XML with Python I'm familiar with, but not creating - last time I had to use 3rd party libraries - 'XMLTramp' I think. A bit of xml.dom.minidom and I had compliant GPX files that Google Earth would accept...
Posted by Domejunky