Help:Extension:Kartographer/sv

Den här sidan visar hur man använder kartritarverktyget och dess taggar och.

Kom igång
 Den här koden kommer att lägga in en enkel, interaktiv karta (som den du ser till höger), med möjlighet att förstora den genom att man antingen dubbelklickar på kartan eller genom att man klickar på symbolen i det övre högra hörnet.

Man kan använda -parametern för att undvika grundinställningen och på det sättet placera den till vänster, höger eller centrerat.

Användning av
 { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-122.3988, 37.8013] }, "properties": { "title": "Exploratorium", "description": "", "marker-symbol": "museum", "marker-size": "large", "marker-color": "0050d0" } }

Innehållet i taggen måste antingen vara tomt eller en giltig GeoJSON med formatering, så som den kan skapas i ett verktyg för GeoJSON-redigering.Kartographer stödjer stiltypen simplestyle med  Maki-symboler (Utgiven under upphovsrättslicensen Creative Commons Zero).

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.

Note: Adding the text attribute automatically enables a frame, even if there is a  attribute.

==

kan också använda den extra parametern "text" för att visa text i stället för koordinater:

Taggen kan ha samma geoJSON som.

=== -parametern. Utan denna parameter visas ordet "map". Om en karta använder GeoJSON sätt symbolen  till värdet   eller. I det här fallet ersätts varje  med räkneverksfunktionen   och    med  -värden.

Om GeoJSON har fler än en räkneverksfunktion är det den första som visas som länktext. Det är möjligt för en bidragsgivare att lägga till ett suffix om man vill ha flera räkneverk samtidigt på sidan. På det här viset får  en annan ordning än.

Det kan vara en bra idé att ha olika färger för olika punkter. All data som läggs in med hjälp av kommer att visas i alla kartor där man använt, om inte värdet   använts.

kan byggas ut till

Värdena,   och   bestämmer kartans position. Använd $alt för länkhjälpstexten,  för själva länktexten (det kan vara vilken wikiformaterad text som helst) och   för innehållet i den aktuella gruppen (se nedan).

Grupper
De olika språkversionerna av Wikivoyage behöver kunna visa en kartbild med information som inte ligger i själva kartan, utan någon annanstans på sidan. Det kan till exempel finnas flera intressepunkter (points of interest, POI), IP, som lagts in med -taggar, men bara en gemensam karta på hela sidan som visar alla punkterna.

Gruppfunktionen ger bidragsgivare möjlighet att dela data mellan flera olika - and -taggar.

Grundinställningen innebär att värdet i - eller -taggen bara visas för just den taggen och inte någon annanstans.

Om mapframe eller specificerar  -funktionen kommer värdena i dessa taggar att läggas in i en viss grupp, tillsammans med alla andra värden som givits samma gruppnamn. Resultatet blir att alla taggar med samma gruppnamn kommer att visa samma kartdata och varje tagg kan lägga till mer data i gruppen.

En tagg kan också visa andra grupper, oavsett om den finns i en grupp eller ej, genom att man specificerar -funktionen. Flera gruppnamn kan användas om de åtskiljs av ett kommatecken. Gruppnamnet kan bara använda engelskspråkiga gemener (Små bokstäver). Den här tabellen visar vilken data som visas för de olika taggarna.

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. 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 after the "#" symbol at ''' 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.

Discovery Maps Update
The Discovery team structure changed in June 2017 and the ability for further map development has diminished; read more about the organizational update and the Discovery update on wiki.

Deploying mapframe on your site
 * Currently, we do not have the technical resources to deploy mapframe to any additional wikis. If a wiki wants to deploy mapframe on their site, they can do it on their own, similar to what the Swedish Wikipedia accomplished, by using the #Wikimedia-Site-requests process.


 * We also do not have the technical resources to do any minor bug fixes, feature requests or any other new deployments at this time. If severe bugs occur—such as maps aren't rendering from the tile servers—we will try our best to get them fixed.


 * If there are bugs or future feature requests for maps, please add them to the Phabricator board for possible future consideration. DTankersley (WMF) (talk) 23:08, 15 June 2017 (UTC)