2

I am able to convert PBF to geojson, but I lack the additional attributes like state, country, city, suburb, type of business etc which is offered by geocoding service like Nominatim.

The geojson just has a name and type:

{ "type": "Feature", "properties": { "osm_id": "519326004", "timestamp": "2014-10-29T19:46:31Z", "name": "Borgo Agnese", "type": "restaurant" }, "geometry": { "type": "Point", "coordinates": [ 16.6015512, 49.1915338 ] } }

But I need all these additional attributes:

[{"place_id":"4709238","licence":"Data © OpenStreetMap contributors, ODbL 1.0. http:\/\/www.openstreetmap.org\/copyright","osm_type":"node","osm_id":"519326004","boundingbox":["49.1914838","49.1915838","16.6015012","16.6016012"],"polygonpoints":[[16.6015512,49.1915838],[16.601586555339,49.191569155339],[16.6016012,49.1915338],[16.601586555339,49.191498444661],[16.6015512,49.1914838],[16.601515844661,49.191498444661],[16.6015012,49.1915338],[16.601515844661,49.191569155339]],"lat":"49.1915338","lon":"16.6015512","display_name":"Borgo Agnese, 43, Kopečná, Staré Brno, Brno, okres Brno-město, Jihomoravský kraj, Jihovýchod, 60200, Czech Republic","class":"amenity","type":"restaurant","importance":0.201,"icon":"http:\/\/nominatim.openstreetmap.org\/images\/mapicons\/food_restaurant.p.20.png","address":{"restaurant":"Borgo Agnese","house_number":"43","road":"Kopečná","suburb":"Staré Brno","city":"Brno","county":"okres Brno-město","state":"Jihovýchod","postcode":"60200","country":"Czech Republic","country_code":"cz"}}]

I can reverse geocode every entry I have in my geojson created from PBF file but that seems cumbersome to me.

Just to note: I have tried Pelias openstreetmap utilities to upload PBF to Elasticsearch, but the quality of information is not sufficient for me.

Is there any proper way how to do this?

1

Pelias gets boundaries from external source (or form OSM but loaded via separate query) and join points with boundaries within ElasticSearch.

Try this https://github.com/kiselev-dv/gazetteer/tree/develop/Gazetteer It uses pretty similar scheme (with some additions) as Pelias.

Run gazetteer.jar from releases with:

bzcat CH.osm.bz | java -jar gazetteer.jar split - none
java -Xmx4g -jar gazetteer.jar slice
java -Xmx4g -jar gazetteer.jar join --handlers out-gazetteer cz.json.gz

And you'll get cz.json.gz with json with all data you need.

And if I don't mind, you have conscription numbers in Czech, so notice that you'll get two lines for each building one with regular address, and another one addressed via conscription number.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.