使用方法/Kartographer
来自康健生活
< 使用方法
mapframe
eq
Example
<mapframe text="Map of [[wikipedia:London|London]]" latitude="51.505" longitude="-0.126" zoom="8" width="300" height="300" align="left">
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"title": "[[wikipedia:London|London]] is the capital of [[wikipedia:United Kingdom|United Kingdom]]",
"description": "[[File:Houses_of_Parliament.jpg|Houses of Parliament|280px]]",
"marker-symbol": "town-hall",
"marker-size": "large",
"marker-color": "f00"
},
"geometry": {
"type": "Point",
"coordinates": [
-0.1226806780323386,
51.515268213580114
]
}
}
]
}</mapframe>
Configuration
| parameter | default | comment |
|---|---|---|
| $wgKartographerWikivoyageMode | false
|
Enables Wikivoyage mode. |
| $wgKartographerUseMarkerStyle | false
|
Allows Kartographer to extract CSS style to be used by the link from the GeoJSON. |
| $wgKartographerStaticMapframe | false
|
Defines if the map will be a static image. |
| $wgKartographerEnableMapFrame | true
|
Enables the tag <mapframe> to be used and create static or interactive maps. |
Implementation
Kartographer makes use of a suite of open-source, open-data tools for displaying maps:
- On the client side (within the browser):
- Leaflet, a JavaScript mapping library
- On the server side:
- Kartotherian, a map tile service developed by the Wikimedia Foundation, which itself contains code from Mapbox. Third party installations should use non-Wikimedia tile servers listed on https://wiki.openstreetmap.org/wiki/Tile_servers
- Generating the data in advance:
- Tilerator, a tile pre-generation service also developed by the Wikimedia Foundation
- OpenStreetMap, an open map data source, the source for the map data as well as for most of the points of interest (POIs).
For more information on these, see Maps#Production maps cluster. For more information on the production aspects of running these services, see the Wikitech Maps page.
maplink
<maplink>
Changing <mapframe> to <maplink> creates a link to a full screen map:
<maplink zoom="13" latitude="37.8103" longitude="-122.3995" />
<maplink> also accepts an extra parameter "text" to specify link text instead of the coordinates:
<maplink text="click me" zoom="13" latitude="37.8103" longitude="-122.3995" />
The <maplink> tag may contain the same geojson as <mapframe>.
<maplink> and auto-counters
<mapframe text="Several groups of automatic counters" width="350" height="350" zoom="13" latitude="37.80151060070086" longitude="-122.39902496337889">
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"marker-symbol": "-number",
"marker-color": "302060"
},
"geometry": {
"type": "Point",
"coordinates": [
-122.41816520690917,
37.79097260220947
]
}
},
{
"type": "Feature",
"properties": {
"marker-symbol": "-number",
"marker-color": "302060"
},
"geometry": {
"type": "Point",
"coordinates": [
-122.40786552429199,
37.799654055191525
]
}
},
{
"type": "Feature",
"properties": {
"marker-symbol": "-number",
"marker-color": "302060"
},
"geometry": {
"type": "Point",
"coordinates": [
-122.40185737609865,
37.796262984039544
]
}
},
{
"type": "Feature",
"properties": {
"marker-symbol": "-number",
"marker-color": "302060"
},
"geometry": {
"type": "Point",
"coordinates": [
-122.38743782043457,
37.80535070427755
]
}
},
{
"type": "Feature",
"properties": {
"marker-symbol": "-number",
"marker-color": "302060"
},
"geometry": {
"type": "Point",
"coordinates": [
-122.38005638122557,
37.795449103799726
]
}
},
{
"type": "Feature",
"properties": {
"marker-symbol": "-letter",
"marker-color": "208020"
},
"geometry": {
"type": "Point",
"coordinates": [
-122.40941047668457,
37.81850557172186
]
}
},
{
"type": "Feature",
"properties": {
"marker-symbol": "-letter",
"marker-color": "208020"
},
"geometry": {
"type": "Point",
"coordinates": [
-122.40357398986815,
37.81280993744834
]
}
},
{
"type": "Feature",
"properties": {
"marker-symbol": "-letter",
"marker-color": "208020"
},
"geometry": {
"type": "Point",
"coordinates": [
-122.39842414855956,
37.8071138637568
]
}
},
{
"type": "Feature",
"properties": {
"marker-symbol": "-number-bar",
"marker-color": "f01080"
},
"geometry": {
"type": "Point",
"coordinates": [
-122.41181373596191,
37.78595317184089
]
}
},
{
"type": "Feature",
"properties": {
"marker-symbol": "-number-bar",
"marker-color": "f01080"
},
"geometry": {
"type": "Point",
"coordinates": [
-122.39542007446289,
37.787674400057654
]
}
},
{
"type": "Feature",
"properties": {
"marker-symbol": "-number-bar",
"marker-color": "f01080"
},
"geometry": {
"type": "Point",
"coordinates": [
-122.38649368286131,
37.78401144262929
]
}
}
]
}
</mapframe>
