Help:Map Data/zh

Map data allows users to store GeoJSON data on wiki, similar to images. Other wikis may use this data to draw on top of the maps, together with other map customizations.

To create a new map data, go to Wikimedia Commons, and create a new page in the Data namespace with the .map suffix, such as. Feel free to experiment by creating pages with the Sandbox/&lt;username>/ prefix. For now, page content can only be edited in the raw JSON format. Eventually, we hope there will be a powerful editor to simplify GeoJSON creation (you can enable the KartoEditor gadget to edit them directly or use the geoJSON website and then copy the GeoJSON data).

Data licensing
All data in the  namespace must licensed under one of the following licences:


 * CC0-1.0
 * CC-BY versions: CC-BY-1.0, CC-BY-2.0, CC-BY-2.5, CC-BY-3.0, CC-BY-4.0, CC-BY-4.0+
 * CC-BY-SA versions: CC-BY-SA-1.0, CC-BY-SA-2.0, CC-BY-SA-2.5, CC-BY-SA-3.0, CC-BY-SA-4.0, CC-BY-SA-4.0+
 * ODbL-1.0

The default license is empty string (e.g invalid license) and when a user tries to save page with invalid license, they will be notified of the allowed licenses.

Top-level fields
Map data has several required and optional top-level elements:

Usage
Use and  tags to show a map together with the custom map data defined in the .map page. For that, add this wiki markup (or similar but without the width and height) to any wiki page in any project, and the content of the Data:Sample.map page from Commons will be drawn. The content will be localized based on the user's interface language settings.

While not a very common usage scenario, a Lua script on any wiki can get map data by calling. The function returns data in almost the same format as the original JSON, except that all localized strings will be converted to regular strings, and the license field will also include a localized license name. To get the data in another language, pass language code as the second parameter. To get the data in the original, unmodified form, use "_" as the language code.

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

Sample map data
full map code

Restrictions and gotchas

 * Each string value except the  must be no more than 400 symbols long. Special characters like new lines   and tabs   are not allowed.
 * The overall size of the page may not exceed 2 MB.
 * Retrieving lines or shapes via Wikidata IDs within a data page will cause the map to break when it is called via maplink or mapframe. A workaround is to add the IDs directly in the maplink or mapframe code:

The sources are drawn in the order in which they are listed in the code—in the example above, the geoshape from Wikidata will appear beneath the components from the data page. This would be reversed if the data page was called before the Wikidata ID.