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

Hi,

I would need all the available points of interest from a country in json/csv format, with the following fields: POI name, POI address, POI city, POI county, POI postcode. Something like what Nominatim returns. I've downloaded the country .osm.pbf file from geofabrik, but the data is not even close to the format I need. What would be the way to go ?

Thanks for your time!

asked 16 Aug '18, 00:46

RollyPeres's gravatar image

RollyPeres
31112
accept rate: 0%


In principle you could do this with the overpass-api however that will only work for very small countries.

Your best bet is likely a combination of osmconvert (as you will probably want polygon centroids for POIs that are not mapped as nodes) and one of the filter applications for example osmfilter or the osmium command line tool.

permanent link

answered 16 Aug '18, 13:19

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701
accept rate: 18%

edited 16 Aug '18, 13:19

1

but Overpass will only show the county, city and postcode if they are mapped on the POI. In some countries this information is mapped as separate relations. I think this is also a problem for osmfilter and osmium (but I'm not familiar with them). You will need to process those boundaries somewhere in the workflow to get the CSV you want.

(17 Aug '18, 06:40) escada

Thanks Simon for the suggestion. I've taken a look at those tool, however I couldn't find a way to get the data in the needed format. What I managed to do is run the osm.pbf file through osmconvert and get it back in osm format. This file contains a bunch of nodes, ways, relations that I'm not familiar with. Are you aware of a command which would extract me the data in the format that I need ?

(18 Aug '18, 18:12) RollyPeres

Exactly what escada commented. In the osm file, some POIs do have a street/postcode/city/county attached to it, but that's rare. For the rest they should probably be calculated somehow from relations or something, but it's not intuitive whatsoever.

(18 Aug '18, 18:16) RollyPeres

For POIs without addresses you really need to have the data in a spatially enabled database to be able to determine the address.

There are essentially these cases you have to consider

  • POI is in a (building-)polygon with address tags
  • POI is in a (building-)polygon which doesn't have address tags but encloses a node (or multiple nodes) with address tags, or has a node (or multiple nodes) with address tags on the outline itself
  • there is a nearby node or other element with address tags
  • there is no nearby element with address tags

Note: the only tags you can expect to find explicitly tagged with a high likelihood are house number and street (addr:housenumber and addr:street), enclosing administrative or postal entities need to be either deduced from enclosing polygons or from other nearby elements.

(18 Aug '18, 19:06) SimonPoole ♦

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:

×710
×181
×42
×28

question asked: 16 Aug '18, 00:46

question was seen: 3,982 times

last updated: 18 Aug '18, 19:08

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