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

I am interested in creating a CSV file of addresses from the the Milton Keynes area (in the format street name, town, postcode, city, latitude, longitude).

alt text

This is what I've done so far:

1) Download osm files for the UK at http://nick.dev.openstreetmap.org/downloads/planet/

2) Run osmfilter:

osmfilter uk.osm --keep="highway=residential =primary =secondary =tertiaty =unclassified" >uk_streets.osm

3) Run osmconvert:

osmconvert uk_streets.osm --csv="@lon @lat addr:city addr:street" --csv-headline --csv-separator=, -o=uk_streets.csv

My problems

  • I can't figure out how to only pull addresses from the Milton Keynes area, the above script seems to pull from the whole of UK (i.e. in the bounds shown in the image above)
  • There were lots of gaps in the data after running the script, I could not find some of the addresses that appeared on the OSM website in the database

How would I refactor my osmfilter and osmconvert commands to pull the necessary information for the Milton Keynes area?

asked 24 Jul '14, 20:02

methuselah90's gravatar image

methuselah90
1111
accept rate: 0%


nominatim (the engine behind the search on the map on osm.org) builds hierarchies out of the OSM data and does not return results based on the unprocessed OSM data. For example if there is a house with just a number it will match that with the nearest road and so on, without doing such processing you will not get the same results.

Back to your question: osmconvert supports clipping on a bounding box or a polygon, see the OSM wiki section on "Applying Geographical Borders". Using a bounding box is likely to be simplest for starters (you already have one displayed in the picture you supplied).

permanent link

answered 25 Jul '14, 07:56

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701
accept rate: 18%

edited 25 Jul '14, 12:04

SK53's gravatar image

SK53 ♦
28.1k48268433

According to the data model used at least in Germany, the information about a city or postalcode area to where a street belons is NOT stored on each street.

For that purpose we have boundary relations, a group of boundary ways in a closed circle that describe an area.

So you should have a look whether these relations are present in the OSM data for your purposes.

About administrative borders, see openmapsurfer (choose grayscale layer with borders overlay) or wambacher's boundary display

Then you have to adjust your osmfilter commands, and find a solution how to determine in which area you have each street.

OR alternatively:

when your area has almost complete addr: data, try keeping it with osmfilter

permanent link

answered 25 Jul '14, 15:33

stephan75's gravatar image

stephan75
12.6k556210
accept rate: 6%

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:

×60
×47

question asked: 24 Jul '14, 20:02

question was seen: 9,329 times

last updated: 25 Jul '14, 15:33

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