Raspberry Pi Pico Tips and Tricks

Sunday 9 February 2014

Using the Open Street Map OSM Mapnik 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 .
----------------------------------------------------------

Open Street Map OSM Mapnik

This is the standard tile server in use for Open Street Map.

URL Template

http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png

Usage policy

The best place to view the detail on the usage policy for Open Street Maps tiles is from their tile usage policy wiki page. The main concern with usage is the load placed on their resources which are finite considering their position as a volunteer run service. So be gentle and when in doubt, check out the wiki.

Attribution

Open Street Map provides open data, licensed under the Open Data Commons Open Database License (ODbL). The cartography in their map tiles is licensed under the Creative Commons Attribution-ShareAlike 2.0 license (CC BY-SA). They require that you use the credit “ © OpenStreetMap contributors” and that the cartography is licensed as CC BY-SA. You may do this by linking to the copyright page athttp://www.openstreetmap.org/copyright.

Usage example

        mapLink = 
            '<a href="http://openstreetmap.org">OpenStreetMap</a>';
        L.tileLayer(
            'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
            attribution: '&copy; ' + mapLink + ' Contributors',
            maxZoom: 18,
            }).addTo(map);
OSM Mapnik 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