Thursday 5 June 2014

Real-time tracking with SPOT and Leaflet

I've created a new plugin, Leaflet.SpotTracker, that makes is super easy to add real-time tracking to your maps. The plugin displays tracking data directly from a SPOT Satellite Messenger, or from CartoDB.

One line is enough if you're using the SPOT API:

L.spotTracker('your_feed_id').addTo(map);

This API has a request limit (500 requests within 15 minutes) and it will only fetch the last 50 messages from the last 7 days. I therefore recommend to sync your messages to CartoDB, or similar storage options. You can also load tracking data from CartoDB with the plugin:

L.spotTracker('your_feed_id', {
    api: 'http://turban.cartodb.com/api/v2/sql',
    url: "{api}?q=SELECT * FROM spot WHERE feed_id='{feed}' ORDER BY timestamp"
}).addTo(map);

A few examples from my kayak trip around Foldøy island (it will work better for longer expeditions):

The plugin will draw a line between all locations recorded, and you can style the line as you like.

You can add clickable dots or markers for each location.

Different message types can be styled differently. 

A pulsing marker will show where you currently are:


[ Fullscreen map | Code ]

This is the first version of the Leaflet.SpotTracker plugin. Please report any issues you might have on GitHub.

2 comments:

Unknown said...

Hi! I have some promblem with import spot data to cartodb..

You can send a sample file config.php?

Unknown said...

Hi! I have some promblem with import spot data to cartodb..

You can send a sample file config.php?