Monday, September 18, 2006

KML faster than GPX

When using feeds from Motionbased, the KML is 5x faster then GPX because the format is that much more compact. So if you're not using the time stamps, course heading, or speed available in the GPX feed, then using KML feed is probably a good idea.

For example:

<trkpt lat="34.1" lon="-118.2">
    <ele>141.5<ele>
    <time>2006-09-12T05:31:20-07:00</time>
    <course>0.0</course>
    <speed>3.834404896762164</speed>
</trkpt>
<trkpt lat="34.3" lon="-118.4">
    <ele>141.5<ele>
    <time>2006-09-12T05:31:21-07:00</time>
    <course>0.0</course>
    <speed>3.834404896762164</speed>
</trkpt> ...
versus
<coordinates>-118.2,34.1,411.1 -118.4,34.3,411.1 ... </coordinates>

I updated my MB/AWX mashup with this and some other improvements: http://www.bjornman.com/mb-in-awx.html

(The old mashup using GPX instead of KML is now available as http://www.bjornman.com/mb-in-awx-using-gpx.html)

The only tricky part with using KML was the irritating bug in the Mozilla/Firefox xml parser where it only gets the first 4096 character with "firstChild.data". Since an activity is often a lot longer, only the first 112 locations showed on the map. Since newer Mozilla/Firefox (though not IE) supports the "textContent" from W3C DOM Level 3, I fixed it by trying both ways of getting at the full "coordinates".

0 comments: