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

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 ♦
accept rate: 19%

edited 25 Jul '14, 12:04

SK53's gravatar image

SK53 ♦

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

accept rate: 6%

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: 24 Jul '14, 20:02

question was seen: 7,441 times

last updated: 25 Jul '14, 15:33

powered by OSQA