NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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


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 (http://wiki.openstreetmap.org/wiki/Key:place), boundary=administrative (http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative) and admin_level (country is 2, city is 8, so anything in that range).

permanent link

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

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×133
×56

question asked: 16 Dec '17, 20:39

question was seen: 2,967 times

last updated: 16 Dec '17, 22:57

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum