`<maplink>` and `<mapframe>` wiki markup needs to specify a list of Wikidata IDs to get shapes stored in the OSM database, or other external data like geo pages or WikiData queries. This way, someone may add a shaded area (e.g. highlight a city/state/country) by specifying their Wikidata ID, instead of copy/pasting the whole geojson with a complex geometry into wikitext.
There are two ways we can do it: via params and by modifying content (geojson) format:
==== As attribute
```lang=html
<mapframe ... show="wikidata:Q12345,wikidata:Q67890">
```
* PROS: simple, integrates well with other group/show concepts
* CONS: hard to specify styling parameters
==== As geojson
```lang=json
{
"type": "WikidataShape",
"properties": { ... }, // same as simple styling
"ids": [ 12345, 67890 ] // Qnumbers
}
```
* PROS: Allows styling, easy to enforce syntax
* CONS: non-standard geojson, not expandable to other data sources
==== As geojson URLs
This approach is identical to the Graph extension's [[ Extension:Graph/Guide#External_Data | external data ]]. It will allow us to specify any external data source, such as geojson pages, wikidata query service, etc.
```lang=json
{
"type": "ExternalData",
"properties": { ... }, // same as simple styling
"href": "osmshapes:///?ids=Q12345,Q67890"
}
```
* PROS: Allows styling, easy to enforce syntax, multiple data sources
* CONS: non-standard geojson
==== Implementation thoughts
The service returns data as highly optimized TopoJSON, with each object IDed with Qnumber. Once decoded into GeoJSON, each Q id is given as a separate feature object:
```lang=json
{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"id": "Q12130",
"properties": {},
"geometry": { "type": "MultiPolygon", ... }
}, { ... }, { ... }]
}
```
**Parsing**: More optimally we should use the [[ https://github.com/mbostock/topojson | TopoJSON library ]], but if we want "all you can eat", we could use the [[ https://github.com/mapbox/leaflet-omnivore | leaflet-omnivore ]].
**Optimization**: To get the best mileage out of TopoJSON, all maps on the page should combine all their requests into one, instead of each retrieving their own. It may be very wasteful for multiple maps to each generate nearly identical request to the server.
**Async**: Each external data item should exist as its own key within the `wgKartographerLiveData`. This way we will have an ability to pre-populate it in some cases. Also, current `getMapGroupData()` needs to be updated - it should check recursively if there are any `"type": "ExternalData"` elements, and if so, it should `$.when(...)` for all missing values. Lastly, I think `getMapGroupData()` should replace all items it requests with a promise. This way if there is more than one map using the same data, the data is requested only once.