This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

planet PBF with only country, city, state for reverse geocoding

0

Hi guys,

Is it possible to slim down a planet .pbf file to only contain Country/City/State names to be used for simple reverse geocoding purposes only?

Any pointers or help will be appreciated.

asked 16 Dec '17, 20:39

cbyter's gravatar image

cbyter
11225
accept rate: 0%

edited 16 Dec '17, 20:46


One Answer:

1

You haven't mentioned a specific geocoder, so I assume you plan to write your own implementation, e.g. using a full-text search engine.

https://wiki.openstreetmap.org/wiki/Osmfilter allows you to extract only the places you want. Start with a small geographic area (e.g. one country) first. Look for place tags (https://wiki.openstreetmap.org/wiki/Key:place), boundary=administrative (https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative) and admin_level (country is 2, city is 8, so anything in that range).

answered 16 Dec '17, 22:24

mtmail's gravatar image

mtmail
4.8k1574
accept rate: 27%

Thanks for the response. I plan on using nominatim, does that change the answer at all?

(16 Dec '17, 22:45) cbyter
1

No, Nominatim is a good choice. It will take care of linking cities to countries, handling all languages, abbreviations. It can't do spell-checking and can't incomplete search terms (type-ahead/autocomplete like search). Nominatim uses https://github.com/openstreetmap/osm2pgsql/blob/master/output-gazetteer.cpp during the import (utils/setup.php) and it might give you some hints on tags. For type-ahead have a look at http://photon.komoot.de/

(16 Dec '17, 22:54) mtmail

Source code available on GitHub .