openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
http://openfoodfacts.github.io/openfoodfacts-server/
GNU Affero General Public License v3.0
660 stars 389 forks source link

Geocode cities #758

Open teolemon opened 7 years ago

teolemon commented 7 years ago

Store coordinates for cities. This should enable us to geolocate a lot of French products, and to enable geolocating foreign products based on their packaging city. Geonames has an export of all cities in the world that we can use. http://www.geonames.org/export/ Geonames is also linked to Wikidata, which should allow us to do interesting things in the future as pointed out by @CloCkWeRX, including OSM relationships, and probably IGP relationships https://www.wikidata.org/wiki/Q213294 -> https://world.openfoodfacts.org/city/clamecy-nievre-france https://www.openstreetmap.org/relation/394020

CloCkWeRX commented 6 years ago

It might be worth linking cities to their wikidata: https://www.wikidata.org/wiki/Q213294 -> https://world.openfoodfacts.org/city/clamecy-nievre-france

That gives you coordinates, but it also gives you rich data and nice cross links to openstreetmap, etc. https://www.openstreetmap.org/relation/394020

hangy commented 6 years ago

Yup, cities need to be introduced with a useful taxonomy instead of the way they're currently extracted for French pacakger codes. Basically, at least packaging codes, origin of ingredients, and manufacturing/processing places link to geographical regions or cities in very similar ways. Also discussed in #392 and linked issues. 😉

teolemon commented 6 years ago

http://www.geonames.org/export/

DE.txt

6553023 Duisburg    Duisburg    Duisburg,Stadt Duisburg 51.42938    6.77435 A   ADM4    DE      07  051 05112   05112000    498590      37  Europe/Berlin   2020-05-23
6553024 Essen   Essen   Essen,Stadt Essen   51.45355    7.0102  A   ADM4    DE      07  051 05113   05113000    583109      93  Europe/Berlin   2020-05-23
6553025 Krefeld Krefeld Krefeld,Stadt Krefeld   51.35157    6.54957 A   ADM4    DE      07  051 05114   05114000    227020      32  Europe/Berlin   2020-05-23
6553026 Mönchengladbach Moenchengladbach    Moenchengladbach,Mönchengladbach,Stadt Moenchengladbach,Stadt Mönchengladbach   51.1958 6.4387  A   ADM4    DE      07  051 05116   05116000    261454      62  Europe/Berlin   2020-05-23
6553027 Mülheim an der Ruhr Muelheim an der Ruhr    Gorad Mjul'gajm-na-Rury,Milchaim,Milkhajm na Ruru,Miulheimas prie Ruro,Miulheimas prie Rūro,Mjul'gajm-na-Ruri,Mjul'khajm-an-der-Rur,Mjul'khajm-na-Rure,Mjulkhajm,Moelm,Muehlheim,Muelhaym,Muelheim,Muelheim an der Ruhr,Muelheim del Ruhr,Mölm,Mühlheim,Mülhaym,Mülheim,Mülheim an der Ruhr,Mülheim del Ruhr,Stadt Muelheim an der Ruhr,Stadt Mülheim an der Ruhr,lu er he pan mi er hai mu,miulhaimi,mwilhaim-andeeoluleu,mwlhaym an dr rwr,myuruhaimu・an・dea・ruru,Μίλχαϊμ,Горад Мюльгайм-на-Руры,Милхајм на Руру,Мюлхайм,Мюльгайм-на-Рурі,Мюльхайм-ан-дер-Рур,Мюльхайм-на-Руре,מילהיים על הרוהר,مل ہائم,مولهايم أن در رور,مولهایم آن در رور,მიულჰაიმი,ミュールハイム・アン・デア・ルール,鲁尔河畔米尔海姆,뮐하임안데어루르 51.4268 6.8806  A   ADM4    DE      07  051 05117   05117000    170880      42  Europe/Berlin   2020-05-23
6553026 Mönchengladbach Moenchengladbach    Moenchengladbach,Mönchengladbach,Stadt Moenchengladbach,Stadt Mönchengladbach   51.1958 6.4387  A   ADM4    DE      07  051 05116   05116000    261454      62  Europe/Berlin   2020-05-23

I can't find a match. https://www.wikidata.org/wiki/Q2758 identifiant GeoNames >> 3247435

Duisbourg identifiant GeoNames 3231901

CloCkWeRX commented 2 years ago

Some possibilities here: https://nominatim.org/release-docs/latest/api/Search/ - Can Nominatin suggest Town / City / Suburb level results for things like "Location purchases" + recommend things with wikidata ids?

https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples#Cities - hit the wikipdata sparql api endpoint for cities/countries?

CloCkWeRX commented 2 years ago

Actually, maybe worth superceding similar to #393 ?