Page MenuHomePhabricator

Provide way to check if reference to external data returns external data
Open, MediumPublic


Currently, if setting "ids" in GeoJSON doesn't return external data and if using auto-positioning (no zoom/lat/long set) then mapframe/maplink simply shows world map (zoomed out to min level). It should be possible to check in template or Lua module syntax if using Wikidata id for current page (or explicitly set Wikidata id) as "ids" value returns nothing (empty/null, no geometry available) or some data about actual geometry (like OSM object id(s) if Wikimedia stores this somewhere in its database, or geometry type(s), or simply "TRUE"). This might be similar to checking if {{#property:}} or respective Lua function returns Wikibase property value or nothing.

Then, according to no external data being available, instead of showing world/blank map, template/module could do something else, like show marker at Wikidata coordinates if appropriate, or show error message, or add tracking category, or do nothing. Without this capability its hard to display external data reliably and conveniently. For instance, if certain type of administrative entity generally has boundary geometry available then currently I should still check if some instance of it has got object or Wikidata id missing on OSM and then show/not show map accordingly, instead of letting infobox do it automatically. Also, even if I checked that geometry for particular entity was available, then it may not be in future as things may be messed up on OSM (happens occasionally) or as OSM generally stores only current data and e.g. boundaries for former entities will be lost when dissolved/merged. Then template could automatically switch to not show map that no longer shows anything related to given page.

Another task (T155925) asks for a parser function that returns OSM object ids for given Wikidata id for different purpose. This may be sufficient here as well, but possibly it makes it harder to tackle (e.g. in case Wikimedia currently doesn't store OSM object ids). Also, possibly the approach here could be more generic, possibly it should also allow checking if "query" or "page" value in GeoJSON returns any external data.