OpenStreetMap may be a suitable candidate to populate the location field in Upload Wizard's Describe step, as per this prototype UI.
Tasks
- assess availability of APIs to populate a location auto-complete field
- understand how geo-coordinates can be handled
- get a glimpse of OpenStreetMap's content
Report
- We're looking for a geocoder, which takes free text as input and outputs geo-coordinates
- we can invoke the geocoder on user input in an autocomplete lookup widget like OOUI's LookupElement
- if available mappings between OpenStreetMap (OSM) and Wikidata (WD) items have a fair coverage, we'll directly query Wikidata
Geocoders
Source: https://wiki.openstreetmap.org/wiki/Geocoding#Open_source_geocoders
- 🚫 Nominatim - OSM search engine
- no autocompletion API: https://nominatim.org/release-docs/develop/api/Search/#free-form-query
- code base: https://github.com/osm-search/Nominatim
- ✅ Photon
- open source API: https://photon.komoot.io/api/?q=asd&limit=5
- code base: https://github.com/komoot/photon
- ✅ Pelias
- commercial API: https://geocode.earth/docs/forward/autocomplete/
- note for free-software projects: https://github.com/pelias/pelias?tab=readme-ov-file#do-you-offer-a-free-geocoding-api
- host an instance: https://github.com/pelias/docker/
- OSM importer: https://github.com/pelias/openstreetmap/
- 🚫 Gisgraphy
- commercial API: https://www.gisgraphy.com/webservices/geocoding.php
- last commit 3 years ago: https://github.com/gisgraphy/gisgraphy
- 🚫 Addok
- only for addresses: https://github.com/addok/addok
- 🚫 Mimirsbrunn
- last commit 2 years ago: https://github.com/Qwant/mimirsbrunn
- documentation still suggests that the project is in progress, so perhaps it was left unmaintained
- 🚫 OSMNames
- gazetteer-based DB, not directly usable: https://github.com/osmnames/osmnames/
OSM-WD mappings
- 12 M OSM relations (12,010,949): https://planet.openstreetmap.org/statistics/data_stats.html
- OSM to WD
- 3.185 M Wikidata tags: https://taginfo.openstreetmap.org/search?q=wikidata#keys
- 5.45% OSM relations (654,927), 0.52% nodes: https://taginfo.openstreetmap.org/keys/wikidata#overview
- 1-n QID-OSM key, top QID is Q122870674: https://taginfo.openstreetmap.org/tags/wikidata=Q122870674#overview - https://taginfo.openstreetmap.org/keys/wikidata#values
- WD to OSM
- 402 k (401,956) QIDs with a OSM relation ID - https://query.wikidata.org/#select%20%28count%28%2a%29%20as%20%3Fcount%29%20where%20%7B%0A%20%20%3Fqid%20wdt%3AP402%20%3Fosmid%20.%0A%7D
- 185 k (185,758 OSM) ways - https://query.wikidata.org/#select%20%28count%28%2a%29%20as%20%3Fcount%29%20where%20%7B%0A%20%20%3Fqid%20wdt%3AP10689%20%3Fosmid%20.%0A%7D
- 264 k (263,837) OSM nodes - https://query.wikidata.org/#select%20%28count%28%2a%29%20as%20%3Fcount%29%20where%20%7B%0A%20%20%3Fqid%20wdt%3AP11693%20%3Fosmid%20.%0A%7D
- OSM's SPARQL endpoint is gone, so no more query federation with WD: https://sophox.org/sparql
Conclusion
- Wikidata mapping coverage is very low
- Pelias looks like the healthiest and most up-to-date geocoder
Actions
- Try to spin up a Pelias instance with OSM data
- in case of any issue with Pelias, try to spin up a Photon instance