Utilisateur:Jean-Louis²/Maplink
Modèle:Documentation subpage Modèle:High-useExposant
Exposant
Modèle:Uses Wikidata Modèle:Sister project
This template adds a link, or frame, which will display a map from OpenStreetMap together with specified map data. The map and data can be viewed in a scrollable and zoomable fullscreen window. The map data can come from:
- data stored in GeoJSON format on Wikipedia or Commons
- line/polygon features in OpenStreetMap.
- coordinates, either supplied or from Wikidata
- raw GeoJSON, preferably transcluded from another page
Note:
- If you have a very large/slow map, you should use the
mapframe
extension tag directly instead of this template, as was done in Special:Diff/970846012. The reason for this is that using the template to call the extension tag will result in the map rendering counting as Lua time, which may result in time exceeded errors. - 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.
Utilisations
modifierCe modèle est destiné à afficher des points ainsi que des entités linéaires ou polygonales sur une carte, y compris (mais sans s'y limiter) :
- des routes
- des rivières
- des lignes de métro ou de train
- des cours de navires
- des trajectoires de vol
- des voyages d'explorateurs
- des zones écologiques
- des pays et leurs subdivisions
et plus...
Ce modèle peut également être utilisé pour afficher des entités ponctuelles sur une carte, c'est-à-dire des coordonnées.
Provenance des données
modifierCe modèle accepte une grande variété de données de provenances diverses.
- Page .map sur Commons data (exemple: Data:ecos.fws.gov/Endangered habitat 58938/Plethodon neomexicanus.map):
- {{maplink|from=}} (spécifier la page data .map en paramètre de from=, en excluant le préfixe Data:)
Erreurs avec GeoJSON
modifier- <maplink> : Le contenu JSON n’est pas compatible avec « GeoJSON+simplestyle ». La liste ci-dessous montre toutes les possibilités pour l’interpréter selon le schéma JSON. Toutes ne sont pas des erreurs.
- /0/ids : Does not match the regex pattern ^Q[1-9]\d{0,19}(\s*,\s*Q[1-9]\d{0,19})*$
- /0/ids : String value found, but an array is required
- /0/ids : Failed to match exactly one schema
- /0/title : The property title is required
- /0/service : Does not have a value in the enumeration ["page"]
- /0 : Failed to match exactly one schema
- /0/geometries : The property geometries is required
- /0/type : Does not have a value in the enumeration ["GeometryCollection"]
- /0/type : Does not have a value in the enumeration ["MultiPolygon"]
- /0/type : Does not have a value in the enumeration ["Point"]
- /0/type : Does not have a value in the enumeration ["MultiPoint"]
- /0/type : Does not have a value in the enumeration ["LineString"]
- /0/type : Does not have a value in the enumeration ["MultiLineString"]
- /0/type : Does not have a value in the enumeration ["Polygon"]
- /0/coordinates : The property coordinates is required
- /0/geometry : The property geometry is required
- /0/type : Does not have a value in the enumeration ["Feature"]
- /0/features : The property features is required
- /0/type : Does not have a value in the enumeration ["FeatureCollection"]
from OSM:
- {{maplink|type=line|id=}} (Wikidata id only required if another article's Wikidata page is to be used)
Basic usage
- <maplink> : Impossible d’analyser les données JSON : Erreur de syntaxe(e.g. (tl)):
- {{maplink|raw=}} (specify raw GeoJSON, preferably transcluded from a subpage of Wikipedia:Map data)
- <maplink> : Le contenu JSON n’est pas compatible avec « GeoJSON+simplestyle ». La liste ci-dessous montre toutes les possibilités pour l’interpréter selon le schéma JSON. Toutes ne sont pas des erreurs.
- /0/ids : Does not match the regex pattern ^Q[1-9]\d{0,19}(\s*,\s*Q[1-9]\d{0,19})*$
- /0/ids : String value found, but an array is required
- /0/ids : Failed to match exactly one schema
- /0/title : The property title is required
- /0/service : Does not have a value in the enumeration ["page"]
- /0 : Failed to match exactly one schema
- /0/geometries : The property geometries is required
- /0/type : Does not have a value in the enumeration ["GeometryCollection"]
- /0/type : Does not have a value in the enumeration ["MultiPolygon"]
- /0/type : Does not have a value in the enumeration ["Point"]
- /0/type : Does not have a value in the enumeration ["MultiPoint"]
- /0/type : Does not have a value in the enumeration ["LineString"]
- /0/type : Does not have a value in the enumeration ["MultiLineString"]
- /0/type : Does not have a value in the enumeration ["Polygon"]
- /0/coordinates : The property coordinates is required
- /0/geometry : The property geometry is required
- /0/type : Does not have a value in the enumeration ["Feature"]
- /0/features : The property features is required
- /0/type : Does not have a value in the enumeration ["FeatureCollection"]
from OSM:
- {{maplink|type=line|id=}} (Wikidata id only required if another article's Wikidata page is to be used)
- <maplink> : Le contenu JSON n’est pas compatible avec « GeoJSON+simplestyle ». La liste ci-dessous montre toutes les possibilités pour l’interpréter selon le schéma JSON. Toutes ne sont pas des erreurs.
- /0/ids : Does not match the regex pattern ^Q[1-9]\d{0,19}(\s*,\s*Q[1-9]\d{0,19})*$
- /0/ids : String value found, but an array is required
- /0/ids : Failed to match exactly one schema
- /0/title : The property title is required
- /0/service : Does not have a value in the enumeration ["page"]
- /0 : Failed to match exactly one schema
- /0/geometries : The property geometries is required
- /0/type : Does not have a value in the enumeration ["GeometryCollection"]
- /0/type : Does not have a value in the enumeration ["MultiPolygon"]
- /0/type : Does not have a value in the enumeration ["Point"]
- /0/type : Does not have a value in the enumeration ["MultiPoint"]
- /0/type : Does not have a value in the enumeration ["LineString"]
- /0/type : Does not have a value in the enumeration ["MultiLineString"]
- /0/type : Does not have a value in the enumeration ["Polygon"]
- /0/coordinates : The property coordinates is required
- /0/geometry : The property geometry is required
- /0/type : Does not have a value in the enumeration ["Feature"]
- /0/features : The property features is required
- /0/type : Does not have a value in the enumeration ["FeatureCollection"]
from OSM:
- {{maplink|type=shape|id=}} (Wikidata id only required if another article's Wikidata page is to be used)
- <maplink> : Le contenu JSON n’est pas compatible avec « GeoJSON+simplestyle ». La liste ci-dessous montre toutes les possibilités pour l’interpréter selon le schéma JSON. Toutes ne sont pas des erreurs.
- /0/ids : Does not match the regex pattern ^Q[1-9]\d{0,19}(\s*,\s*Q[1-9]\d{0,19})*$
- /0/ids : String value found, but an array is required
- /0/ids : Failed to match exactly one schema
- /0/title : The property title is required
- /0/service : Does not have a value in the enumeration ["page"]
- /0 : Failed to match exactly one schema
- /0/geometries : The property geometries is required
- /0/type : Does not have a value in the enumeration ["GeometryCollection"]
- /0/type : Does not have a value in the enumeration ["MultiPolygon"]
- /0/type : Does not have a value in the enumeration ["Point"]
- /0/type : Does not have a value in the enumeration ["MultiPoint"]
- /0/type : Does not have a value in the enumeration ["LineString"]
- /0/type : Does not have a value in the enumeration ["MultiLineString"]
- /0/type : Does not have a value in the enumeration ["Polygon"]
- /0/coordinates : The property coordinates is required
- /0/geometry : The property geometry is required
- /0/type : Does not have a value in the enumeration ["Feature"]
- /0/features : The property features is required
- /0/type : Does not have a value in the enumeration ["FeatureCollection"]
from OSM:
- {{maplink|type=shape-inverse|id=}} (Wikidata id only required if another article's Wikidata page is to be used)
- Erreur Lua : Coordinates must be specified on Wikidata or in |coord=. (coordinates):
- Erreur Lua : Page «Netherton Tunnel Branch Canal» non trouvée. from a page or section ({{coord}} templates using the
|name=
parameter) - Erreur Lua : Coordinates must be specified on Wikidata or in |coord=. (centred on a point's coordinates):
- To show in a frame, add the parameter
|frame=yes
: {{maplink|frame=yes|frame-align=left|type=line|id=Q1094308|text=Mapframe example}}.
- Additional parameters are available to customise the displayed map, such as
|plain=yes
to remove the outer frame: {{maplink|frame=yes|frame-align=left|plain=yes|type=line|id={{get QID|Várkerület}}|frame-width=200|frame-height=250|frame-long=19.1009|frame-lat=47.5001|zoom=9}}.<mapframe> : Le contenu JSON n’est pas compatible avec « GeoJSON+simplestyle ». La liste ci-dessous montre toutes les possibilités pour l’interpréter selon le schéma JSON. Toutes ne sont pas des erreurs. - /0/ids : Does not match the regex pattern ^Q[1-9]\d{0,19}(\s*,\s*Q[1-9]\d{0,19})*$
- /0/ids : String value found, but an array is required
- /0/ids : Failed to match exactly one schema
- /0/title : The property title is required
- /0/service : Does not have a value in the enumeration ["page"]
- /0 : Failed to match exactly one schema
- /0/geometries : The property geometries is required
- /0/type : Does not have a value in the enumeration ["GeometryCollection"]
- /0/type : Does not have a value in the enumeration ["MultiPolygon"]
- /0/type : Does not have a value in the enumeration ["Point"]
- /0/type : Does not have a value in the enumeration ["MultiPoint"]
- /0/type : Does not have a value in the enumeration ["LineString"]
- /0/type : Does not have a value in the enumeration ["MultiLineString"]
- /0/type : Does not have a value in the enumeration ["Polygon"]
- /0/coordinates : The property coordinates is required
- /0/geometry : The property geometry is required
- /0/type : Does not have a value in the enumeration ["Feature"]
- /0/features : The property features is required
- /0/type : Does not have a value in the enumeration ["FeatureCollection"]
- Overlays can also be displayed on top of the map: {{maplink|frame=yes|frame-align=left|frame-width=400|frame-height=300|type=point|id=Q8688|marker=airport|zoom=12
|text=San Francisco International Airport
|overlay={{Graph:Street map with marks|width=110|height=90|lat=37.8|lon=-121.8|zoom=6|{ "lat": 37.618, "lon": -122.375 }| minimap=false}}}}
Pour des raisons techniques, il est temporairement impossible d'afficher le graphique qui aurait dû être présenté ici.
Parameter set – data page
{{maplink
|display=
|from=
|zoom=
|text=
|icon=
}}
Parameter set – raw data
{{maplink
|display=
|raw= <!-- preferably {{Wikipedia:Map data/subpage}} -->
|zoom=
|text=
|icon=
}}
Parameter set – geoline/geoshape
{{maplink
|display=
|type=
|id=
|title=
|description=
|stroke-color=
|stroke-width=
|zoom=
|text=
|icon=
}}
Parameter set – point features/coordinates
{{maplink
|display=
|type=point
|id=
|title=
|description=
|coord=
|marker=
|zoom=
|text=
|icon=
}}
Parameter set – circles
{{maplink
|display=
|type=circle
|radius= <!-- in metres, alternative parameters available for other units -->
|id=
|title=
|description=
|coord=
|marker=
|zoom=
|text=
|icon=
}}
Parameters
modifierFor overall display
modifier- 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, unless the only feature is a single point.
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 in pixels, default is
300
- frame-height
- Height of the map frame in pixels, default is
200
- frame-coordinates
- (or frame-coord)
- Optional - coordinates of the center of the map. Use (tl) template to specify coordinates (e.g.
|frame-coordinates={{Coord|12.34|S|56.78|W}}
). If not set, coordinates will be retrieved from Wikidata. - frame-latitude
- (or frame-lat)
- (ignored if
|frame-coordinates=
or|frame-coord=
is set) - Optional - latitude coordinate for center of the map.
- frame-longitude
- (or frame-long)
- (ignored if
|frame-coordinates=
or|frame-coord=
is set) - Optional - longitude coordinate for center of the map.
- Modèle:A note If frame latitude and longitude are not set by parameters, then frame coordinates can be determined automatically, either:
- Based on the line and shape objects (if any have been specified), or
- From the point feature specified in
|coord=
(if set), or - Retrieved from Wikidata (if available – for either the item specified in
|id=
parameter, or for the page the template is placed on)
- overlay
- An image, or another map, to be displayed on top the map. E.g.
|overlay=Modèle:Elc
or|overlay={{maplink|frame=yes|plain=yes|frame-width=100|frame-height=100|type=shape|id={{get QID|French submarine Ariane (1914)}}|frame-align=center}}
or|overlay={{Graph:Street map with marks|width=100|height=100|lat=37.8|lon=-122.4|zoom=6|{ "lat": 37.8, "lon": -122.4 }|minimap=false}}
- (see Template:Maplink/testcases/overlays to view examples)
- overlay-horizontal-alignment
- Horizontal alignment of overlay, either
left
orright
; default isright
- overlay-vertical-alignment
- Vertical alignment of overlay, either
top
orbottom
; default isbottom
- overlay-horizontal-offset and overlay-vertical-offset
- Optional – number of pixels to offset the overlay in from the edge of the map, e.g.
10
for a 10 pixel gap - overlay-border
- CSS style for the border, e.g.
3px solid black
; default is1px solid white
. The colour can be any web color name or hex code.
Raw GeoJSON
modifier- 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
modifierMultiple 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. Higher numbers are drawn on top.
- 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)named
– all named coordinates in an page or section ({{coord}} templates with|name=
parameter)circle
– a circle centred on a point's 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
- Source of map data:
- If type is
data
or omitted: The JSON (.map) file from Commons to display (excluding theData:
prefix) - If type is
named
: Page name, or name#section, to get named coordinates from. If omitted, or specified as just #section, then current page will be used.
- If type is
- 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
- stroke-opacity
- Opacity for the lines used to draw the feature (for features from OSM) – a number between
0
(fully transparent) and1
(fully opaque); default is1
- fill
- Color code for the fill color of the feature (for shape or shape-inverse features from OSM); default is
#000000
(black). Note that a semi-transparent version of the specified color will be used by default, allowing the map below to still be seen. - fill-opacity
- Opacity for the fill color of the feature (for shape or shape-inverse features from OSM) – a number between
0
(fully transparent) and1
(fully opaque); default is0.5
- coord
- Coordinates to display for a point feature. Use (tl) template to specify coordinates (e.g.
|coord={{Coord|12.34|S|56.78|W}}
). 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
() - marker-size
- Size of the marker. Can be
small
,medium
(default) orlarge
. - radius
- (or radius_m), or alternative parameters radius_km, or radius_mi, or radius_ft
- Radius of the circle. In metres by default, or in kilometers or miles or feet if the alternative parameters are used.
- edges
- Number of edges used to construct the circle. Default is
32
. Higher numbers will result in a smoother circle but use more Lua processing resources.
TemplateData
modifierAdds a link, or frame, which will display map data
Paramètre | Description | Type | État | |
---|---|---|---|---|
display | display | How the template is displayed
| Inconnu | facultatif |
text | text | Text to display for the link (or caption if using mapframe)
| Ligne de texte | facultatif |
icon | icon | Set to "no" to turn off the icon that appears next to the link | Booléen | facultatif |
zoom | zoom | Zoom level, from 1 to 19 (larger numbers zoom in further); default is automatically determined by the map, unless the only feature is a single point. | Nombre | facultatif |
Multiple map switcher
modifierAn option for Template:Switcher-style switching of multiple mapframes, where specified parameters like zoom, or frame coordinates, or a shape's item id are switched between different values. When using, ensure the number of values in each list are the same.
Instructions:
- Add parameter switch to specify labels for the different options: a list separated by either
,
, or;
if the labels contain commas, or###
if the labels contain semi-colons. Each label will be displayed with a prefix of "Show ".- Example:
|switch=zoomed out, zoomed mid, zoomed in
- Example:
- For each parameter that is to be switched, set its value to (kbd) followed by a list of values to switch between, again separated by
,
or;
or###
- Example:
|zoom=SWITCH:4,9,14
- Parameters frame, plain, and text should not be switched
- Example:
- Make sure each list has the same number of entries. The position of value in a (kbd) list corresponds to the same position in the list of labels set in
|switch=
.
Example: Erreur Lua dans Module:Carte_interactive à la ligne 333 : Les paramètres de latitude et/ou de longitude sont absent.
{{mapframe|frame=yes|type=point|id=Q100|text=Boston|zoom=SWITCH:4,9,14|switch=zoomed out, zoomed mid, zoomed in}}
Examples and tips
modifierMultiple features
modifierMultiple features allow you to:
- Use external data from both Wikimedia Commons and OpenStreetMap together
- Apply different styles to different external data features from OpenStreetMap
- Include multiple links to external data from Wikimedia Commons
Erreur Lua dans Module:Mapframe à la ligne 398 : attempt to perform arithmetic on local 'long_d' (a nil value).
{{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={{coord|32|S|116|E}}|title3=Point|description3=Description of point
}}
{{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
}}
Infoboxes
modifierMapframes 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). Modèle:Infobox Australian road
{{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
modifierThe "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
modifier{{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 examples
modifier{{maplink|frame=yes|text=Ten countries|raw={
"type": "ExternalData",
"service": "geoshape",
"query": "
SELECT * WHERE {
?id wdt:P463 wd:Q1065 .
} LIMIT 10
"}
|frame-width=600|frame-height=400|frame-lat=25|frame-long=10|zoom=1
}}
{{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
modifier- 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.
Tutorials
modifierRedirects
modifierSee also
modifier- Wikipedia:Maps for Wikipedia, a list of mapping tools available on Wikipedia
- Wikipedia:Maplink, an informational page about this and similar templates
- Template:Mapbox – a derivative of this template that puts the link inside a right-aligned box
- Template:Attached KML
Ancienne page
modifier2 coordinates
modifierModèle:Coord Module:Coordinates
<li> <a class="mw-kartographer-maplink mw-kartographer-link" data-mw-kartographer="" data-style="osm-intl" href="#/maplink/32" data-zoom="13" data-lat="52.499036" data-lon="-2.064032" data-overlays="["_f1466946a926468e7c01f1b88b08502335435334"]">52° 29′ 57″ N, 2° 03′ 51″ O </a> </li>
Modèle:Coord2 Module:CoordinatesEN
<li> <style data-mw-deduplicate="TemplateStyles:r193347592">.mw-parser-output .geo-default,.mw-parser-output .geo-dms,.mw-parser-output .geo-dec{display:inline}.mw-parser-output .geo-nondefault,.mw-parser-output .geo-multi-punct{display:none} </style> <span class="plainlinks nourlexpansion"> <a class="external text" href="//geohack.toolforge.org/geohack.php?pagename=Utilisateur:Hens_Jean-Louis/Maplink¶ms=52.499036_N_2.064032_W_region:GB_type:landmark&title=Air+vent+No.+4" rel="noopener" target="_blank"> <span class="geo-nondefault"> <span class="geo-dms" title="Maps, aerial photos, and other data for this location"> <span class="latitude"> 52°29′57″N </span> <span class="longitude"> 2°03′51″W </span> </span> </span> <span class="geo-multi-punct"> / </span> <span class="geo-default"> <span class="vcard"> <span class="geo-dec" title="Maps, aerial photos, and other data for this location"> 52.499036°N 2.064032°W </span> <span style="display:none"> / <span class="geo"> 52.499036; -2.064032 </span> </span> <span style="display:none"> ( <span class="fn org"> Air vent No. 4 </span> ) </span> </span> </span> </a> </span> </li>
Modèle:Coord3 Module:CoordinatesFR
<li> <span class="plainlinks nourlexpansion" title="Cartes, vues aériennes, etc."> <a class="external text" href="http://tools.wmflabs.org/geohack/geohack.php?language=fr&pagename=Utilisateur:Hens_Jean-Louis/Maplink¶ms=52.499036_N_2.064032_W_region:GB_type:landmark&title=Air+vent+No.+4" rel="noopener" target="_blank"> <span class="h-card"> <data class="p-name" value="Air vent No. 4"> </data> <span class="h-geo geo-dms"> <data class="p-latitude" value="52.499036"> 52° 29′ 57″ N </data> , <data class="p-longitude" value="-2.064032"> 2° 03′ 51″ O </data> </span> </span> </a> </span> </li>
Modèle:Coordirection Module:Coordirection
2 coordinates again
modifierModèle:Coord Module:Coordinates
Modèle:Coord2 Module:CoordinatesEN
Maplink
modifierErreur Lua : No named coordinates found in Utilisateur:Jean-Louis²/Maplink.
Erreur Lua : No named coordinates found in #2 coordinates.
Erreur Lua : No named coordinates found in #2 coordinates.
Modèle:Maplink Module:Mapframe
--[[ Gets all named coordiates from a page or a section of a page. @param {string|nil} page Page name, or name#section, to get named coordinates from. If the name is omitted, i.e. #section or nil or empty string, then the current page will be used. @returns {table} sequence of {coord, name, description} tables where coord is the coordinates in a format suitable for #util.parseCoords, name is a string, and description is a string (coordinates in a format suitable for displaying to the reader). If for some reason the name can't be found, the description is nil and the name contains display-format coordinates. @throws {L10n.error.noNamedCoords} if no named coordinates are found. ]]-- function util.getNamedCoords(page) if transcluder == nil then -- load [[Module:Transcluder]] lazily so it is only transcluded on pages that -- actually use named coordinates transcluder = require("Module:Transcluder") end local parts = mw.text.split(page or "", "#", true) local name = parts[1] == "" and mw.title.getCurrentTitle().prefixedText or parts[1] local section = parts[2] local pageWikitext = transcluder.get(section and name.."#"..section or name) local coordTemplates = util.extractCoordTemplates(pageWikitext) if #coordTemplates == 0 then error(string.format(L10n.error.noNamedCoords, page or name), 0) end local frame = mw.getCurrentFrame() local sep = "________" local expandedContent = frame:preprocess(table.concat(coordTemplates, sep)) local expandedTemplates = mw.text.split(expandedContent, sep) local namedCoords = {} for _, expandedTemplate in pairs(expandedTemplates) do local coord = mw.ustring.match(expandedTemplate, "<span class=\"geo%-dec\".->(.-)</span>") if coord then local name = ( -- name specified by a wrapper template, e.g [[Article|Name]] mw.ustring.match(expandedTemplate, "<span class=\"mapframe%-coord%-name\">(.-)</span>") or -- name passed into coord template mw.ustring.match(expandedTemplate, "<span class=\"fn org\">(.-)</span>") or -- default to the coordinates if the name can't be retrieved coord ) local description = name ~= coord and coord local coord = mw.ustring.gsub(coord, "[° ]", "_") table.insert(namedCoords, {coord=coord, name=name, description=description}) end end if #namedCoords == 0 then error(string.format(L10n.error.noNamedCoords, page or name), 0) end return namedCoords end
et
--[[ Recursively extract coord templates which have a name parameter. @param {string} wikitext @returns {table} table sequence of coord templates ]]-- function util.extractCoordTemplates(wikitext) local output = {} local templates = mw.ustring.gmatch(wikitext, '{%b{}}') local subtemplates = {} for template in templates do local templateName = mw.ustring.match(template, '{{([^}|]+)') local nameParam = mw.ustring.match(template, "|%s*name%s*=%s*[^}|]+") if util.isCoordTemplateOrWrapper(templateName) then if nameParam then table.insert(output, template) end elseif mw.ustring.find(mw.ustring.sub(template, 2), "{{") then local subOutput = util.extractCoordTemplates(mw.ustring.sub(template, 2)) for _, t in pairs(subOutput) do table.insert(output, t) end end end -- ensure coords are not using title display for k, v in pairs(output) do output[k] = mw.ustring.gsub(v, "|%s*display%s*=[^|}]+", "|display=inline") end return output end
Cela devrait fonctionner seulement avec le Modèle:Coord2 qui semble être un clone de la version anglaise, mais malheureusement non. Pourquoi ?
Maplink
modifierDébogage Mapframe
Modèle:Maplink Module:Mapframe
Erreur Lua : No named coordinates found in Utilisateur:Jean-Louis²/Maplink.
Erreur Lua : No named coordinates found in #2 coordinates.
Erreur Lua : No named coordinates found in #2 coordinates.
![Carte](https://maps.wikimedia.org/img/osm-intl,10,a,a,300x200.png?lang=fr&domain=fr.wikipedia.org&title=Utilisateur%3AJean-Louis%C2%B2%2FMaplink&revid=205326935&groups=_e6beac3174f955e26f53de39fe496ef926d86e71)
{{maplink |frame=yes |zoom=10 |type=line|id=Q650274 |type2=point|id2=Q650274 |text=Commune de [[Houffalize]] }}
{{maplink |frame=yes |frame-width=400 |type=line |id=Q1497 |text=[[Mississippi (fleuve)]] }}
Column header 1 | Column header 2 | Column header 3 | Column header 4 |
---|---|---|---|
Row header 1 | Cell 2 | Cell 3 | Cell 4 |
Row header A | Cell B | Cell C | Cell D |
{{maplink|frame=yes|text=Ten countries|raw={
"type": "ExternalData",
"service": "geoshape",
"query": "
SELECT * WHERE {
?id wdt:P463 wd:Q1065 .
} LIMIT 10
"}
|frame-width=600|frame-height=400|frame-lat=25|frame-long=10|zoom=1
}}
{{maplink|frame=yes|text=Ten countries|raw={
"type": "ExternalData",
"service": "geoshape",
"query": "
SELECT * WHERE {
?id wdt:P463 wd:Q1065 .
} LIMIT 10
"}
|frame-width=600|frame-height=400|frame-lat=25|frame-long=10|zoom=1
}}
{{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}}