"ഫലകം:Maplink/doc" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം
(fix link) |
(add original link) |
||
(ഒരേ ഉപയോക്താവ് ചെയ്ത ഇടയ്ക്കുള്ള 3 നാൾപ്പതിപ്പുകൾ പ്രദർശിപ്പിക്കുന്നില്ല) | |||
വരി 10: | വരി 10: | ||
<!--{{High-use|7,000+}}--> | <!--{{High-use|7,000+}}--> | ||
<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE --> | <!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE --> | ||
This template Imported from [https://en.wikipedia.org/wiki/Template:Maplink/doc English Wikipedia] | |||
This template adds a link, or frame, which will display map data – either from: | This template adds a link, or frame, which will display map data – either from: | ||
വരി 17: | വരി 18: | ||
*raw GeoJSON, preferably transcluded from another page | *raw GeoJSON, preferably transcluded from another page | ||
Note: | Note: | ||
*GeoJSON files cannot currently be directly uploaded. Instead, on [ | *GeoJSON files cannot currently be directly uploaded. Instead, on [https://commons.wikimedia.org/wiki/Main_Page Commons], create a page that is in the <code>Data:</code> namespace and ends in <code>.map</code> – see [https://www.mediawiki.org/wiki/Help:Map_Data mw:Help:Map Data] for further information. | ||
*To make OpenStreetMap (OSM) features available, add the Wikidata key to the OSM relation (and wait 1 or 2 days) – see [https://www.mediawiki.org/wiki/Help:Extension:Kartographer#External_data mw:Help:Extension:Kartographer#External_data] and [https://www.mediawiki.org/wiki/Help:Extension:Kartographer/OSM mw:Help:Extension:Kartographer/OSM] for further information. | *To make OpenStreetMap (OSM) features available, add the Wikidata key to the OSM relation (and wait 1 or 2 days) – see [https://www.mediawiki.org/wiki/Help:Extension:Kartographer#External_data mw:Help:Extension:Kartographer#External_data] and [https://www.mediawiki.org/wiki/Help:Extension:Kartographer/OSM mw:Help:Extension:Kartographer/OSM] for further information. | ||
വരി 35: | വരി 36: | ||
==Usage== | ==Usage== | ||
Basic usage | Basic usage | ||
*{{maplink|type=line|id=Q1094308|text=Line of a border or a linear feature}} from OSM: | *{{maplink|type=line|id=Q1094308|text=Line of a border or a linear feature}} from OSM: | ||
*:<code><nowiki>{{maplink|type=line|id=}}</nowiki></code> (Wikidata id only required if another article's Wikidata page is to be used) | *:<code><nowiki>{{maplink|type=line|id=}}</nowiki></code> (Wikidata id only required if another article's Wikidata page is to be used) | ||
വരി 45: | വരി 43: | ||
*{{maplink|type=shape-inverse|id=Q1094308|text=Inverted shape}} from OSM: | *{{maplink|type=shape-inverse|id=Q1094308|text=Inverted shape}} from OSM: | ||
*:<code><nowiki>{{maplink|type=shape-inverse|id=}}</nowiki></code> (Wikidata id only required if another article's Wikidata page is to be used) | *:<code><nowiki>{{maplink|type=shape-inverse|id=}}</nowiki></code> (Wikidata id only required if another article's Wikidata page is to be used) | ||
*To show in a frame, add the parameter {{para|frame|yes}}. | *To show in a frame, add the parameter {{para|frame|yes}}. | ||
{{maplink|frame=yes|type=line|id=Q1094308|text=Mapframe example}} | {{maplink|frame=yes|type=line|id=Q1094308|text=Mapframe example}} | ||
വരി 177: | വരി 172: | ||
==Examples and tips== | ==Examples and tips== | ||
===Infoboxes=== | ===Infoboxes=== |
15:21, 27 ജൂൺ 2024-നു നിലവിലുള്ള രൂപം
![]() | This template uses Lua: |
![](/images/thumb/f/ff/Wikidata-logo.svg/40px-Wikidata-logo.svg.png)
This template Imported from English Wikipedia
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:
- GeoJSON files cannot currently be directly uploaded. Instead, on Commons, create a page that is in the
Data:
namespace and ends in.map
– see mw:Help:Map Data for further information. - To make OpenStreetMap (OSM) features available, add the Wikidata key to the OSM relation (and wait 1 or 2 days) – see mw:Help:Extension:Kartographer#External_data and mw:Help:Extension:Kartographer/OSM for further information.
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
- Line of a border or a linear feature from OSM:
{{maplink|type=line|id=}}
(Wikidata id only required if another article's Wikidata page is to be used)
- Shape from OSM:
{{maplink|type=shape|id=}}
(Wikidata id only required if another article's Wikidata page is to be used)
- Inverted shape from OSM:
{{maplink|type=shape-inverse|id=}}
(Wikidata id only required if another article's Wikidata page is to be used)
- To show in a frame, add the parameter
|frame=yes
.
- Additional parameters are available to customise the displayed 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 linkinline,title
- Displays the inline link as well as the title linktitle,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
to19
(larger numbers zoom in further); default is automatically determined by the map
(Note that automatically determined zoom level does not work for mapframe maps except when previewing the page – see phab:T193455)
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
, orright
; default isright
- 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-long)
- Optional - alternate longitude coordinate for initial placement of map
- If frame latitude and longitude are not set by parameters, then coordinates in
|coord=
will be used (if set), or coordinates will be retrieved from Wikidata (if available, for either the item specified in|id=
parameter or for the page the template is placed on)
Raw GeoJSON
- raw
- Raw GeoJSON (preferably transcluded from a subpage of Wikipedia:Map data) as well as <maplink> functionality not available via the other parameters. See below for more information.
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 {{Coord}} 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. If not set, a plain marker will be shown without an image.
- marker-color
- (or marker-colour)
- Color code (Hex triplet) specifying marker background color. Default is
5E74F3
( )
Examples and tips
Infoboxes
Mapframes can be included in infoboxes. Using |plain=yes
to remove the outer frame is recommended.
For simple cases with a single feature, {{infobox mapframe}}
can be used instead (see that template's documentation for details).
Mitchell Freeway | |
---|---|
![]() | |
Map of Perth's northern suburbs with Mitchell Freeway highlighted in red | |
Type | ഫ്രീവേ |
{{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) ... }}
The raw parameter
The "raw" parameter allows the same inputs as the full <maplink> function. It allows you to:
- Use GeoJSON data directly
- Use Wikidata queries to obtain information for the map
- Use templates - if a map includes direct GeoJSON or many components, placing the data in a template will avoid cluttering the article text
See mw:Help:Extension:Kartographer for instructions.
Raw GeoJSON example
{{maplink|raw={{Wikipedia:Map data/Main Roads Western Australia/Forrest Highway}}|text=Route map}}
(Link to GeoJSON data subpage: Wikipedia:Map data/Main Roads Western Australia/Forrest Highway)
Raw Wikidata query example
{{maplink|frame=yes|raw={ "type": "ExternalData", "service": "geoshape", "query": " SELECT ?id ?head (SAMPLE(?img) as ?img) (min(?partyId) as ?party) (if(?party = '0', '#800000', if(?party = '1', '#000080', '#008000')) as ?fill) (concat('[[', substr(str(?link),31,500), '{{!}}', ?headLabel, ']]') as ?title) (concat(?stateLabel, '\\n', '[[File:', substr(str(?img), 52, 500), '{{!}}200px]]') as ?description) WHERE { ?id wdt:P31 wd:Q35657 . ?id wdt:P6 ?head . ?head wdt:P102 ?party . BIND(if(?party = wd:Q29468, '0', if(?party = wd:Q29552, '1', '2')) as ?partyId) SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' . ?head rdfs:label ?headLabel . ?id rdfs:label ?stateLabel . } OPTIONAL { ?head wdt:P18 ?img . } ?link schema:about ?head . ?link schema:isPartOf <https://en.wikipedia.org/> . } GROUP BY ?id ?head ?headLabel ?link ?stateLabel "}|frame-width=600|frame-height=400|frame-lat=52|frame-long=-110|zoom=3}}
Gotchas
- When retrieving lines or shapes from OSM, you can't style the fill color or the opacity level of fills or strokes (unless you use the
|raw=
parameter) - The following code utilising the
|raw=
parameter won't work because the curly brace to close the GeoJSON is adjacent to the curly braces to close the template:
{{Maplink|raw= {"type": "ExternalData","service": "geoshape","ids": "Q13518258"}}}
- To fix it, put a space before the two template braces or move them to a separate line.
Redirects
- {{Map link}}
- {{Mapframe}}
See also
- Template:Mapbox - a derivative of this template that puts the link inside a right-aligned box
- Template:Attached KML