I am building a Nominatim server which will serve as reverse geocoding api server. Only city/state(province)/country information are required in the api result. The street/road level information are not required.

For example, the server will give result: http://localhost/nominatim/reverse?lat=43.815031&lon=-79.716834

{ city:Brampton; state:Ontario; country:Canada }

I would like to use osmosis to filter the data before I import the whole planet data. What command line should I use for this purpose? How about the one below? Thank you.

filter relations by administrative

osmosis --read-pbf planet-latest.osm.pbf --tf accept-relations boundary=administrative --used-way --used-node --lp --write-pbf import1.osm.pbf

filter ways by administrative

osmosis --read-pbf planet-latest.osm.pbf --tf accept-ways boundary=administrative --used-node --tf reject-relations --lp --write-pbf import2.osm.pbf

merge all files together

osmosis --read-pbf import1.osm.pbf --read-pbf import2.osm.pbf --merge --write-pbf import.osm.pbf

This question is marked "community wiki".

asked 23 Nov '16, 18:48

CQG's gravatar image

accept rate: 0%

edited 23 Nov '16, 19:43

You should also include all nodes/relations with the place tag because in countries with less coverage cities are often just nodes without boundaries.

http://taginfo.openstreetmap.org/keys/?key=place#values Not all values are interesting, try 'state','county','district','city','territorial','town','island'

permanent link

answered 24 Nov '16, 11:08

mtmail's gravatar image

accept rate: 29%

Good point. Thank you so much.

(24 Nov '16, 15:54) CQG
Your answer
toggle preview

Follow this question

By Email:

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



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:


question asked: 23 Nov '16, 18:48

question was seen: 2,110 times

last updated: 24 Nov '16, 15:54

powered by OSQA