الگو:Maplink/توضیحات

از ویکی‌پدیا، دانشنامهٔ آزاد

This template adds a link, or frame, which will display map data – either from:

  • data stored in GeoJSON format on Commons
  • line/polygon features in OpenStreetMap.
  • coordinates, either supplied or from Wikidata
  • raw GeoJSON, preferably transcluded from another page

Note:

Uses[ویرایش]

This template is intended for linear or polygon features, including (but not limited to):

  • Roads
  • Rivers
  • Subway or train lines
  • Ship courses
  • Flight paths
  • Explorers journeys
  • Animal habitats
  • Countries and their subdvisions

and more... This template can also be used to display point features on a map, i.e. coordinates.

Usage[ویرایش]

Basic usage

Map
Mapframe example
  • Additional parameters are available to customise the displayed map.

Map

Full parameter set – data page

{{maplink
|display=
|from=
|zoom=
|text=
|icon=
}}

Full parameter set – raw data

{{maplink
|display=
|raw= <!-- preferably {{Wikipedia:Map data/subpage}} -->
|zoom=
|text=
|icon=
}}

Full parameter set – geoline/geoshape

{{maplink
|display=
|type=
|id=
|title=
|description=
|stroke-color=
|stroke-width=
|zoom=
|text=
|icon=
}}

Full parameter set – point features/coordinates

{{maplink
|display=
|type=point
|id=
|title=
|description=
|coord=
|marker=
|zoom=
|text=
|icon=
}}

Parameters[ویرایش]

For overall display[ویرایش]

display
How the template is displayed. Valid values are:
inline - Only displays the inline link (you can forego this, as it is the default)
title - Only displays the title link
inline,title - Displays the inline link as well as the title link
title,inline - Same as above
text
Text to display for the link (or caption if using mapframe); default is "Map"
icon
Set to "no" to turn off the icon that appears next to the link
zoom
Zoom level, from 1 to 18 (larger numbers zoom in further); default is automatically determined by the map

Mapframe parameters (only work with inline display)

frame
Set to "yes" to show a map frame instead of a link
plain
Set to "yes" to show just the map without the surrounding frame, and without a caption (text parameter will be ignored)
frame-align
Alignment with respect to the page: left, center, or right; default is right
frame-width
Width of the map frame, default is 300
frame-height
Height of the map frame, default is 200
frame-latitude
(or frame-lat)
Optional - alternate latitude coordinate for initial placement of map
frame-longitude
(or frame-lat)
Optional - alternate longitude coordinate for initial placement of map

Raw GeoJSON[ویرایش]

raw
The raw GeoJSON, preferably transcluded from a subapge of Wikipedia:Map data

For each feature[ویرایش]

Multiple features can be displayed on a single map. For each additional feature, add a sequential number to the end of the parameter name. For example, the second uses parameters like |type2=, |id2=, etc., the third feature |type3=, |id3=, etc., and so on.

type
Type of data. Valid values are:
line – a geoline feature from OSM (e.g. a road)
shape – a geoshape feature from OSM (e.g. a state or province)
shape-inverse – a geomask feature from OSM (the inverse of a geoshape - allows an unobstructed view of the map beneath)
data – a geoJSON data page on Commons (parameter is optional in this case)
point – a point feature (coordinates)
id
(or ids)
Wikidata id (Q-number) of the point feature, Wikidata id that the OSM line/shape feature is tagged with. Separate multiple ids with a comma. Defaults to the current page's Wikidata id (if |from= not set).
from
The JSON (.map) file from Commons to display (excluding the Data: prefix)
title
Title of the feature (for features from OSM), displayed when the feature is clicked on; default is the page title
description
Description of the feature (for features from OSM), displayed when the feature is clicked on; optional
stroke-color
(or stroke-colour)
Color code for the color used to draw the feature (for features from OSM); default is #ff0000 (red)
stroke-width
Width for the lines used to draw the feature (for features from OSM); default is 6
coord
Coordinates to display for a point feature. Use {{CoordM}} template to specify coordinates. If not set, coordinates will be retrieved from Wikidata.
marker
Name of Maki marker image to display at the point feature. See mw:Maps/Icons for options. Defaults to marker (plain marker) if not set.
marker-color
(or marker-colour)
Color code (Hex triplet) specifying marker background color. Default is 5E74F3 ( )

Examples using multiple features[ویرایش]

Map
Map
{{Maplink|frame=yes
|type=shape|id=Q3495894|title=Shape|description=Description of shape
|type2=line|id2=Q1318331|title2=Line|description2=Description of line
|type3=point|coord3={{coordM|32|S|116|E}}|title3=Point|description3=Description of point
}}

Map

{{Maplink|frame=yes|plain=yes|frame-width=250|frame-height=280|zoom=6|frame-lat=29.185|frame-long=76.225
|type=shape-inverse|id=Q1174|title=Haryana
|type2=point|id2=Q200663|stroke-width=3|title2=Faridabad
}}

Infobox example[ویرایش]

Mitchell Freeway
Map
Map of Perth's northern suburbs with Mitchell Freeway highlighted in red
نوعآزادراه
{{Infobox Australian road
| location = {{maplink |type=line |frame=yes |plain=yes |frame-align=center |frame-lat=-31.8262 |frame-long=115.7877 |zoom=9}}
  ...  (other parameters omitted)  ...
}}

Things this template can't do[ویرایش]

This template is designed to make it simple to insert a map into a page. It supports the most common types of usage, but some of the capabilities of the full <maplink> function are not available. Here are the things this template can't do:

  • Directly style the fill color or the opacity level of fills or strokes (data from Commons will inherit the styling specified in the .map page)
  • Use Wikidata queries to obtain information for the map

Use the full <maplink> or <mapframe> function if you need to do any of these things - see mw:Help:Extension:Kartographer for instructions.

Things this template can do[ویرایش]

  • Use a combination of data sources together (direct GeoJSON, external data from Wikimedia Commons and external data from OpenStreetMap)
  • Apply different styles to different external data features from OpenStreetMap
  • Include multiple links to external data from Wikimedia Commons

See also[ویرایش]