Help:Extension:Kartographer/mk

Страницава го документира начинот на примена на додатокот „Картограф“ (Kartographer) и неговите ознаки и.

Како да почнете
 Овој код вметнува проста интерактивна карта (како оваа десно), со можност за нејзино целосно отворање со двоен стисок или на иконата во десниот агол.

A single-click is used to pan the map; double-clicking (or clicking the icon in the right corner) opens a full-screen map, which is also interactive. Single-clicking opens a full-screen map, which is interactive.
 * On Wikivoyage and test2wiki, this embedded map is interactive.
 * On Wikipedia and other Wikimedia wikis, this embedded maps is static.

Можете да го користите параметарот  за да го заобиколите основно зададената положба на картата (десно), избирајќи дали да стои лево, по средината или десно. The attribute  allows for zoom levels between 0 and 19. Zero is the furthest out, 19 the furthest in.

Maps can also be added with the VisualEditor, see section below.

If the map uses features, as explained below, zoom, latitude, and longitude do not need to be set, the map will automatically adjust to fit all features. Width and height however, must always be set. Width can be set with pixels, % or, whereas height must be in pixels.

Употреба на
 { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-122.3988, 37.8013] }, "properties": { "title": "Exploratorium", "description": "", "marker-symbol": "museum", "marker-size": "large", "marker-color": "0050d0" } }

Содржината на ознаката треба да биде празна, или да има важечки GeoJSON со стилизација, според созададеното од уредник на GeoJSON. „Картограф“ ги поддржува [$simple простостилските одредби] со икони од Maki (под лиценцата Криејтив комонс Нула). Kartographer supports the simplestyle specification with Maki icons (Licensed under Creative Commons Zero). Help:Extension:Kartographer/Icons contains a full list of supported icons.

Frames
Frameless maps are good for insertion as part of a template, whereas framed maps are good for insertion directly into the page, either by hand or by using the visual editor.


 * To insert a map without a frame, add the "frameless" attribute:
 * To add a caption, use the  attribute.

Замената на со  дава врска за целоекранска карта:

исто така го прифаќа дополнителниот параметар „text“ за укажување на текст за врската наместо координати:

Add additional classes to with the class attribute. For instance  to hide the pin in front of the link.

Ознаката може да го содржи истиот geojson како.

и автобројачи
 { "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        ]      }    }  ] }

создава врска која, кога ќе се стисне на неа, ја прикажува картата на целиот екран. Текстот на врската може да се зададе со атрибутот $text. Без овој атрибут, ќе се прикажуваат координати (пример:  attribute.  Without this attribute, the coordinates will be shown (example:   is set to the magic   or   value. In this case each  will be replaced with an incremental counter , and   with   values.

Ако GeoJSON има повеќе од еден бројач, во текстот на врската ќе се прикажува вредноста на првиот. По избор, уредниците можат да додадат наставка за да имаат едновремено повеќе бројачи на страницата. Вака $numbermuseum ќе има различен бројач од $numberbar. Optionally, editors may add a suffix to have multiple counters on the page at the same time. This way  will have different counter from.

Пожелно е да се користи различна боја за секоја одбројувачка група. Сите податоци ставени преку ќе се појавуваат и на сите карти вметнати со, освен ако не се користи атрибутот.

може да се прошири на

Атрибутите,   и   ја заповедаат положбата на отскочната карта. Користете $alt за текст на поткажувачот. Користете $text за текст на врската (било каков текст со важечки викиознаки). Користете $group за да ја ставите содржината на оваа ознака во именуваната група (видете подолу). Use  for the text of the link (could be any valid wikitext markup). Use  to add the contents of this tag to the named group (see below).

Markers
Markers can be added to maps to denote a location. These features are added using the JSON format. contains a full list of icons that can be used as marker symbols.

Result:

Markers can also contain information such as images and links to articles.

Result (interact with marker to see result):

Wikidata IDs for OSM data can be used to highlight borders using the geoshape service.

Result:

Wikidata IDs can be used to mask the entire map except a specified region.

Result:

Markers can be numbered.

Result:

Markers can use letters.

Result:

Add several map markers in different sizes using a feature collection.

Result:

Add groups of different colored map markers and different counters.

Result:


 * Map markers can use any color that has a RGB value (a quick internet search of "rgb color picker" will show several options).
 * Markers can be one of three different sizes: small, medium or large.
 * GeoJSON that is created elsewhere can be copied (in accordance with licensing and copyright restrictions) and then pasted into  (for example)
 * If you are creating maps on Wikivoyage, it might be a good idea to use Groups (see below).
 * If you want to learn more about adding external data to your map, see the External data section.

Групи
За употреба на Википатување, има потреба од прикажување на карти чии податоци се зададени на некое друго место на страницата. На пример, може да има повеќе точки од интерес (POI) укажани со ознаки, и една заедничка карта бочно на страницата што ги прикажува сите нив.

Концептот на групирање им овозможува на уредниците да споделуваат податоци помеѓу повеќе ознаки и.

По основно, податоците во ознаката или  се прикажуваат само за таа ознака, и на ниедно друго место.

Ако или  укажат атрибут , податоците во тие ознаки ќе бидат ставени во именувана група, заедно со сите останати податоци со истото групно име. Така, сите ознаки со ист групен назив ги прикажуваат истите картографски податоци, и секоја ознака може накачувачки да додава податоци во групата.

Ознаката може да прикажува и други групи, без оглед на тоа дали припаѓа на група, укажувајќи го атрибутот. Можат да се укажат повеќе групни називи, одделени со запирки. Називот на групата може да содржи само мали англиски букви. Оваа матрица покажува кои податоци ќе се прикажуваат за секоја ознака.

External data
 { "type": "ExternalData", "service": "geoshape", "ids": "Q797" }

In addition to drawing polygons using GeoJSON, you may also get outlines of the well known geographical objects by their Wikidata ID if they are marked as such in the OpenStreetMap database. For example, the Wikidata item for Alaska is Q797, and we can draw it on a map by using the "external data" reference. More than one ID may be specified separated by a comma. To create a mask over the areas of interest, use the "geoshape" service. To invert this and create a mask over everything else, use the "geomask" service.

GeoShapes via Wikidata Query
 { "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(, ?headLabel, ) as ?title) (concat(?stateLabel, '\\n', '') 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  .} GROUP BY ?id ?head ?headLabel ?link ?stateLabel" }

While this helps with the simple use cases when the Wikidata ID is well known, sometimes you may want to get a list of IDs as a result of a Wikidata query. A SPARQL query gets a list of all US states in the ID column of the result, and geoshapes service adds the geometrical outlines for each state (note that the variable must be called ). All other columns in the SPARQL query result become values in the "properties" object. The "fill" column changes the color of the state. The "title" column shows state governor's name, and "description" has wiki markup to show the state name and the governor's picture. To edit this query, copy the query parameter to ''' https://query.wikidata.org/#... ''':

Map data from Commons

 *  Further information: 

Map data stored on Commons can be drawn on the map. For example, c:Data:Neighbourhoods/New York City.map:

 { "type": "ExternalData", "service": "page", "title": "Neighbourhoods/New York City.map" }

Combining multiple data types
 [ {    "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" } } ]

You can combine ExternalData, Feature, and FeatureCollection together in the same &lt;mapframe> or &lt;maplink> element:

 [ {    "type": "ExternalData", "service": "page", "title": "Neighbourhoods/New York City.map" }, {    "type": "ExternalData", "service": "geoshape", "ids": "Q160409", "properties": { "fill": "#07c63e", "title": "Central Park" } },  {    "type": "Feature", "properties": {"title": "Roosevelt Island", "marker-color": "f01080"}, "geometry": { "type": "Point", "coordinates": [ -73.94511222839355,       40.76734665426719      ]    }  } ]

Map data from Commons can be combined with other types of data:

Styling Wikidata ID elements
 { "type": "ExternalData", "service": "geoline", "ids": "Q2108", "properties": { "title": "Highway I-696", "description": "", "stroke": "#ffb100", "stroke-width": 8 } }

For external data, you can also add styles and titles, using the properties keyword:

The main style keys are: "stroke" (color), "stroke-width", "stroke-opacity", "fill" (color), "fill-opacity".

Overlapping elements
Map elements that overlap are drawn in the order in which they are written in the code. For instance, if a map includes two lines that overlap, the line that is defined first will appear beneath the line that is defined second. The following examples show how this can affect the appearance of the map:

 { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {"fill": "#ff0000","fill-opacity": 0.7,"stroke-width": 0}, "geometry": { "type": "Polygon", "coordinates": [ [ [ 77.926025390625, -25.150257104114733 ], [ 80.14251708984374, -25.150257104114733 ], [ 80.14251708984374, -24.43714786161562 ], [ 77.926025390625, -24.43714786161562 ], [ 77.926025390625, -25.150257104114733 ] ] ] } }, { "type": "Feature", "properties": {"stroke": "#fffa00","stroke-width": 5}, "geometry": { "type": "LineString", "coordinates": [ [ 77.926025390625, -25.150257104114733 ], [ 80.14251708984374, -24.43714786161562 ] ] } }, { "type": "Feature", "properties": {"stroke": "#000000","stroke-width": 5}, "geometry": { "type": "LineString", "coordinates": [ [ 77.926025390625, -24.43714786161562 ], [ 80.14251708984374, -25.150257104114733 ] ] } } ] }

The code for the map above includes three elements, all of which use GeoJSON's "feature" functionality. The first feature is a "Polygon" - the red rectangle. This is followed by two "LineString" features. The yellow line is defined first, so it appears beneath the black line. Note that the hierarchy used to draw elements applies regardless of whether the data is raw GeoJSON or comes from a Wikidata ID or Commons data page.

The map below changes the order from that of the first example: the black line is defined first and is thus moved to the bottom of the stack:

 { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {"stroke": "#000000","stroke-width": 5}, "geometry": { "type": "LineString", "coordinates": [ [ 77.926025390625, -24.43714786161562 ], [ 80.14251708984374, -25.150257104114733 ] ] } }, { "type": "Feature", "properties": {"fill": "#ff0000","fill-opacity": 0.7,"stroke-width": 0}, "geometry": { "type": "Polygon", "coordinates": [ [ [  77.926025390625,  -25.150257104114733  ],  [  80.14251708984374,  -25.150257104114733  ],  [  80.14251708984374,  -24.43714786161562  ],  [  77.926025390625,  -24.43714786161562  ],  [  77.926025390625,  -25.150257104114733  ]  ]  ]  } }, { "type": "Feature", "properties": {"stroke": "#fffa00","stroke-width": 5}, "geometry": { "type": "LineString", "coordinates": [ [ 77.926025390625, -25.150257104114733 ], [ 80.14251708984374, -24.43714786161562 ] ] } } ] }

Rendering options
The following table shows how a map can be formatted for display on a wiki page. The table contains two columns: the first shows an interactive map via the tag, and the second showing the rendering of an example image with the same options.

Use the width value  in order to make the map take up the full width of the page.  

Map languages
Map labels will try to use the language of the wiki where the embedded map is displayed. If that language is not available, then the map will use fallback language as described.


 * 1) Look for value in the requested language
 * 2) Look for value in a language (or languages) that are specifically defined as fallback languages
 * 3) Look for a transliterated value
 * 4) Look for label in the local language
 * 5) If no value is found, display no label.

You can specify the language to use for labels by adding the  followed by the desired language code. e.g. lang="ja" to display labels in Japanese (if available).

Result: . This shows map labels in the languages of the area mapped (essentially opting out of internationalization). This post gives more guidance about when, and why, you might wish to user lang="local"—and generally explains how OpenStreetMap multilingual data works.

Without the  attribute, maps will display in the language of the wiki in which they appear.

Map language fallbacks
Initially these fallbacks follow those found in MediaWiki. The language fallbacks for Maps are stored in fallbacks.json and can be made different than the MediaWiki settings. Individual Wikimedia projects can [https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?title=Request%20to%20change%20Maps%20fallback%20for%20XXXX%20Wiki&tags=Maps&description=Please%20provide%20a%20link%20to%20community%20consensus%20for%20this%20change.%0A%0AA%20description%20of%20the%20requested%20fallback%20is%20also%20needed. request a change to this fallback process] in Phabricator. More Technical information can be found in T192701.

Maps use map data, including map label data for all languages, from the open-source mapping project OpenStreetMap. If the map you want to display doesn't offer labels in the desired language, you can add labels in that language by adding them to OpenStreetMap. To get you started, there is an OpenStreetMap Beginners’ Guide, and guidance about naming conventions. Note that country and city names are drawn from label nodes in OpenStreetMap, not from the data attached to boundary relations.

A community can decide to change its language fallbacks
Read all about changing your language's fallbacks on the Map Improvements project page.