Mqttcogs Now Supports Leaflet

We’ve already seen that it is possible to show a simple plot of longitude and latitudes from a JSON payload. See Visualize OwnTracks GPS Data.

If you like simple Google maps this works but isn’t particularly flexible. You can only display points on the Google map using the very limited Google Map Visualization. If you also want to track ‘assets’ you’ll be liable at some point to pay a fee per asset. This is not good!

I added the ability to visualize using the Leaflet mapping library. You can set this up to use open source maps and the library is flexible enough to allow fancy stuff like polylines to be drawn!

Lets draw a Leaflet map in a similar way to our Google map. This is really easy. Just use an mqttcogs_drawleaflet shortcode. This draws points in a similar way to a Google Map Visualization in the link above.

[ mqttcogs_drawleaflet 
	refresh_secs="15" 
	height="400px" 
	options="{center:{lat:52,lng:1},zoom:13}"]
    [ mqttcogs_data 
		topics="owntracks/ckandroid"
		order="DESC"
		limit="100"]
[/mqttcogs_drawleaflet ]

…and here is the result.




No Comments


You can leave the first : )



Leave a Reply

Your email address will not be published. Required fields are marked *