Wikimedia Maps/2015-2017/Technical Implementation

From mediawiki.org

Getting started[edit]

maps.wikimedia.org serves standard Web Mercator raster tiles so it should be a drop-in replacement for other tileservers serving OpenStreetMap-based imagery. To point a tool to our mapserver, use the following URL schema:

  • https://maps.wikimedia.org/{style}/{z}/{x}/{y}{r}.{format}
  • https://maps.wikimedia.org/{style}/{z}/{x}/{y}@{scale}x.{format} - with the optional scaling factor
URL parameters
style Map style to use. Use "osm-intl" for map with labels, "osm" for map without labels.
z zoom level, 0-19
x, y Web Mercator grid coordinates
r Standard retina option (@2x)
scale Optional scale for the high-resolution screens such as Retina. Supported scales are 1.3, 1.5, 2, 2.6, 3
format Use "png" for now, but you can also use "pbf" from the /osm style to get the raw vector tiles.

Adding a maps within Leaflet is as easy as

var style = 'osm-intl';
var server = 'https://maps.wikimedia.org/';

// Create a map
var map = L.map('map').setView([40.75, -73.96], 4);

// Add a map layer
L.tileLayer(server + style + '/{z}/{x}/{y}{r}.png', {
    maxZoom: 19,
    id: 'wikipedia-map-01',
    attribution: 'Wikimedia maps beta | Map data &copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap contributors</a>'
}).addTo(map);

An example of a map that uses our tiles is at  https://maps.wikimedia.orgsource.

Static map images[edit]

Maps are also capable of serving static images, such as https://maps.wikimedia.org/img/osm-intl,7,43.66,4.719,800x600.png

URL:  https://maps.wikimedia.org/img/{style},{z},{lat},{lon},{width}x{height}@{scale}x.png

URL parameters
style Map style to use. Use "osm-intl" for map with labels, "osm" for map without labels.
z Zoom level, 0–18
lat, lon Latitude and longitude of the map center
width, height Image size in pixels without scalling
scale Optional scale for the high-resolution screens such as Retina. Supported scales are 1.3, 1.5, 2, 2.6, 3

See Also[edit]