D3 Tips and Tricks v4

Tuesday, 11 February 2014

Using the Transport tile server with leafet.js

The following post is a portion of the Leaflet Tips and Tricks book which is free to download. To use this post in context, consider it with the others in this blog or just download the the book as a pdf / epub or mobi .
----------------------------------------------------------

Transport

The ‘Transport’ set of map tiles is distributed by the good folks at Thunderforest who brought you OpenCycleMap. The tiles are designed to show a high level of detail of available public transport. They are based on data from the OpenStreetMap project.

URL Template

http://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png

Usage policy

There are some simple guidelines on the Thunderforest terms and conditions page. The main concern with usage is the load placed on resources. So be gentle.

Attribution

Thunderforest provides open data, under a Creative Commons licence, specifically CC-BY-SA 2.0. The full details are available on their terms and conditions page. Attribution must be given to both “Thunderforest” and “OpenStreetMap contributors”. Users of your map must have a working link to www.thunderforest.com.

Usage example

mapLink = '<a href="http://openstreetmap.org">OpenStreetMap</a>';
translink = '<a href="http://thunderforest.com/">Thunderforest</a>';
L.tileLayer(
    'http://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png', {
        attribution: '&copy; '+mapLink+' Contributors & '+translink,
        maxZoom: 18,
    }).addTo(map);
Transport tile server map

More Examples

I will post separate examples of the usage of different tile servers as separate posts. Or you can find them all in Leaflet Tips and Tricks.



The description above (and heaps of other stuff) is in the Leaflet Tips and Tricks book that can be downloaded for free (or donate if you really want to :-)).

No comments:

Post a Comment