Monday, 17 February 2014

Using the Open Street Map Black and White 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 Black and White

This is variation on the standard tile server in use for Open Street Map but in black and white / grey-scale.

URL Template

http://{s}.www.toolserver.org/tiles/bw-mapnik/{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}.www.toolserver.org/tiles/bw-mapnik/{z}/{x}/{y}.png', {
  attribution: '&copy; ' + mapLink + ' Contributors',
  maxZoom: 18,
  }).addTo(map);
OSM Black and White 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 :-)).

3 comments:

  1. They moved. And while they still have the "tiles" tool running, I don't find the "bw-mapnick" anymore. Any ideas where to find it or something similar?

    ReplyDelete
    Replies
    1. Apologies for the extremely late answer to your question. I expect that you have moved on, but I'll try and provide some guidance for anyone else who might read.
      Darn! You're right it looks like there has been a number of their tile sets that have been plundered by some users in violation of the use agreement. Read more here; http://wiki.openstreetmap.org/wiki/Blocked_applications
      I had a search about, but couldn't locate an alternative sorry :-(.

      Delete
    2. Actually I may have spoken too soon. While there isn't the same map available the 'toner' map is pretty similar. Details here http://maps.stamen.com/#watercolor/12/37.7706/-122.3782

      Delete