[go: up one dir, main page]

Wikimedia Maps/API

Description of the maps.wikimedia.org api services. Note that usage of the API is limited.

Map Tiles

edit

These map tiles are used by Kartographer to display tiles in a leaflet map viewer.

https://maps.wikimedia.org/{mapstyle}/{z}/{x}/{y}{r}.{filetype}?lang={lang}

  • {mapstyle} is one of osm-intl, osm or osm-pbf
    • osm-intl (default) labels in language {lang} with fallback to language of location
    • osm (without labels)
    • osm-pbf (protocol buffers for vector tiles)
  • {z}, {x}, {y} in the standard OSM url pattern.
  • {r} is optional but used for high density with the @2x value
  • {filetype}: generally png, but also: json, headers, svg, jpeg, pbf
  • {lang}: the language to use for the labels

Kartographer static map renderings

edit

The static map renderer can generate a specific preview of any area (custom tile) and can also retrieve overlay information from a wiki and add that overlay to the generated img.

https://maps.wikimedia.org/img/osm-intl,{z},{x},{y},{width}x{height}.png?lang={lang}&domain=www.mediawiki.org&title=Help%3AExtension%3AKartographer&groups=_2d548b4a9c350f3449686b3d25f49a17a57aa004

  • domain: domain generating/requesting the image
  • title: title of the page on which the image will be embedded
  • groups: an optional reference to the cached json of the overlays (Wikidata queries or Commons mapdata) generated by domain+title. When specified also requires domain and title.

This server will query the originating wiki and retrieve map information using the Mapdata API.

OSM Geoshapes and lines

edit

Returns topojson or geojson shapes and line of OSM relations and ways

The service will return topojson to the queries such as /geoshape?ids=Q1384,Q1166 (get New York and Michigan state shapes).

  • Additionally, the service allows query=... parameter to make a query to the http://query.wikidata.org service. It calls the service to execute a query, extracts IDs, and matches them with the shapes in the OSM database. All other values are returned as topojson object properties.
  • Optional truthy parameter getgeojson=1 will force the result to be returned as geojson rather than topojson.

POI images

edit

These POI images are used by Kartographer to overlay features on dynamic maps and used by Kartotherian to render static map images. The style of the poi images is Maki. See also Help:Extension:Kartographer/Icons

Where:

  • {icon}: is the name of the icon
  • {size}: is one of s, m, l
  • {content}: is an optional number/letter to put inside the pin icon
  • {color}: is the color with which to render the POI icon
  • {scale}: is an optional @2x and retrieves highdpi resolution of the image