Help:Extension:Kartographer/zh

此页面记载如何使用Kartographer扩展及其 与 标签的信息.

入门
 This code will insert a simple interactive map (like what you see on the right), with the ability to maximize it by either double-clicking the map or clicking the icon in the right corner.

You may use the  parameter to override default alignment to left, right, or center.

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

The content of the  tag has to be either empty or a valid GeoJSON with styling, as produced by a GeoJSON editor. Kartographer supports the simplestyle specification with Maki icons (Licensed under 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.

GeoShapes external data
 { "type": "ExternalData", "href": "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 Open Street Map database. For example, Wikidata item for Alaska is Q797, and we can draw it on the map by using "external data" reference. More than one ID may be specified separated by a comma.

Note: Wikidata IDs are relatively new to the OSM community. There are only about 40,000 polygons with IDs. To add more, visit http://www.openstreetmap.org/ and add Wikidata tag with the Q value.  { "type":"ExternalData", "href":"geoshape:///?query=SELECT%20%3Fid%20%3Fhead%0A%28SAMPLE%28%3Fimg%29%20as%20%3Fimg%29%20%0A%28SAMPLE%28%3Ffill%29%20as%20%3Ffill%29%20%0A%28concat%28%22%5B%5Bwikipedia%3A%22%2C%20substr%28str%28%3Flink%29%2C31%2C100%29%2C%20%20%22%20%7C%20%22%2C%20%3FheadLabel%2C%20%22%5D%5D%22%29%20as%20%3Ftitle%29%0A%28concat%28%3FstateLabel%2C%20%22%5Cn%22%2C%20%22%5B%5BFile%3A%22%2C%20substr%28str%28%3Fimg%29%2C%2052%2C%20100%29%2C%20%22%7C200px%5D%5D%22%29%20as%20%3Fdescription%29%0AWHERE%20%7B%0A%20%20%0A%20%20%3Fid%20wdt%3AP31%20wd%3AQ35657%20.%0A%20%20%3Fid%20wdt%3AP6%20%3Fhead%20.%0A%20%20%3Fhead%20wdt%3AP102%20%3Fparty%20.%0A%20%20BIND%28if%28%3Fparty%20%3D%20wd%3AQ29468%2C%20%22%23800000%22%2C%20if%28%3Fparty%20%3D%20wd%3AQ29552%2C%20%22%23000080%22%2C%20%22%23008000%22%29%29%20as%20%3Ffill%29%20%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%20.%0A%20%20%20%20%3Fhead%20rdfs%3Alabel%20%3FheadLabel%20.%0A%20%20%20%20%3Fid%20rdfs%3Alabel%20%3FstateLabel%20.%0A%20%20%7D%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fhead%20wdt%3AP18%20%3Fimg%20.%0A%20%20%7D%0A%20%20%3Flink%20schema%3Aabout%20%3Fhead%20.%0A%20%20%3Flink%20schema%3AisPartOf%20%3Chttps%3A%2F%2Fen.wikipedia.org%2F%3E%20.%0A%7D%20GROUP%20BY%20%3Fid%20%3Fhead%20%3FheadLabel%20%3Flink%20%3FstateLabel%0A" } 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 ''' http://query.wikidata.org/#... .''':

== to   creates a link to a full screen map:

also accepts an extra parameter "text" to specify link text instead of the coordinates:

The  tag may contain the same geojson as.

== creates a link that shows a full screen map when clicked. The link text can be set with the  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.

If GeoJSON has more than one counter, the value of the first one will be shown as the link text. Optionally, editors may add a suffix to have multiple counters on the page at the same time. This way  will have different counter from.

It would make sense to use a distinct color for each counting group. All data added via  will also be shown in all maps inserted with , unless the   attribute is used.

could be expanded into

The attributes,  , and   control the location of the popup map. 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).

组
For use on the Wikivoyage project, there is a need to show a map whose data is defined somewhere else on the page. For example, there may be multiple points of interest (POI) defined with  tags, and one common map on the side of the page that shows them all.

The grouping concept allows editors to share data between multiple  and   tags.

By default, the data inside the  or   tag is shown only for that one tag, and will not be shown anywhere else.

If  or   specify the   attribute, the data inside those tags will be placed into a named group, together with all the other data by the same group name. As a result, any tags with the same group name will show the same map data, and each tag may incrementally add data to the group.

A tag may also show other groups, regardless if it belongs to a group or not, by specifying the  attribute. Comma-separated multiple group names may be specified. The group name may only contain lower case English letters. This matrix shows what data will be shown for each tag.