Template:Mapbox raw data/doc

From blackwiki
< Template:Mapbox raw data
Revision as of 00:17, 7 April 2017 by imported>Gareth
Jump to navigation Jump to search

This is a version of Template:Mapbox that accepts raw map data. It allows the full power of <maplink> to be utilised.

Usage

{{Mapbox raw data}} styles a maplink and puts it in a box to the right of the page.

An example: Template:Sidebox

{{mapbox raw data|zoom=16|text=Example map using ''Mapbox raw data''|text-left=yes|data=
[
  {
    "type": "ExternalData",
    "service": "geoshape",
    "ids": "Q13518258",
    "properties": {
      "stroke": "#ffb100",
      "stroke-width": 6,
    }
  },
  {
    "type": "Feature",
    "geometry": { "type": "Point", "coordinates": [4.75566, 44.104498] },
    "properties": {
      "title": "Porte de Castellan"
    }
  },
  {
    "type": "Feature",
    "geometry": { "type": "Point", "coordinates": [4.75829, 44.10258] },
    "properties": {
      "title": "Porte Léon Roche"
    }
  }
]
}}

The same map using a standard maplink: <maplink zoom="16" text="Example map using maplink> [

 {
   "type": "ExternalData",
   "service": "geoshape",
   "ids": "Q13518258",
   "properties": {
     "stroke": "#ffb100",
     "stroke-width": 6,
   }
 },
 {
   "type": "Feature",
   "geometry": { "type": "Point", "coordinates": [4.75566, 44.104498] },
   "properties": {
     "title": "Porte de Castellan"
   }
 },
 {
   "type": "Feature",
   "geometry": { "type": "Point", "coordinates": [4.75829, 44.10258] },
   "properties": {
     "title": "Porte Léon Roche"
   }
 }

] </maplink>

<maplink zoom="16" text="Example map using ''maplink''">
[
  {
    "type": "ExternalData",
    "service": "geoshape",
    "ids": "Q13518258",
    "properties": {
      "stroke": "#ffb100",
      "stroke-width": 6,
    }
  },
  {
    "type": "Feature",
    "geometry": { "type": "Point", "coordinates": [4.75566, 44.104498] },
    "properties": {
      "title": "Porte de Castellan"
    }
  },
  {
    "type": "Feature",
    "geometry": { "type": "Point", "coordinates": [4.75829, 44.10258] },
    "properties": {
      "title": "Porte Léon Roche"
    }
  }
]
</maplink>

While Template:Mapbox and the similar Template:Maplink attempt to make simple maps easier to insert into a page, Mapbox raw data uses exactly the same data format for the map itself as the standard <maplink> function. Compared to Template:Mapbox, Mapbox raw data can do the following:

  • Use GeoJSON data directly
  • Use a combination of data sources together (direct GeoJSON, external data from Wikimedia Commons and external data from OpenStreetMap)
  • Style data (excluding data from Commons)
  • Include multiple links to external data from Wikimedia Commons
  • Use Wikidata queries to obtain information for the map

Parameters

data
A link to external data from Wikimedia Commons or OpenStreetMap and/or any valid GeoJSON data; the only required parameter
text
Text to display for the link; default is "View map"
text-left
Set this to yes to change the link text from centre-aligned to left-aligned
zoom
Zoom level, from 1 to 18 (larger numbers zoom in further); will be automatically determined if not set
latitude
longitude
Specify the centre point of the map; will be automatically determined if not set

See also