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

I've done some looking around but can't figure out if this is possible:

I need a file of placenames in the UK along with their lat/lng. Similar to this:

http://wiki.openstreetmap.org/wiki/List_of_London_Underground_stations

Does such a thing exist?

Chris.

asked 01 Feb '13, 16:15

Chris1970's gravatar image

Chris1970
1111
accept rate: 0%


I'm afraid this probably doesn't readily exist. But for sure it is possible to generate this, although this require the use of more advanced techniques. I could imagine two different approaches:

Filter the data locally from downloaded data

First you have to get the country extract for the UK e.g. from Geofabrik. Also you have to get Osmosis and familiarize yourself with the usage. Osmosis allows you to extract all place nodes, use something like --tag-filter accept-nodes place=*. This gives you an XML file containing the information, you will have to reformat it somehow to get the list you're looking for.

Use Overpass API to get the data

Overpass API allows you to do the filtering directly. Here you'll have to use something like < has-kv k="place" />. But doing so for all places in the UK might be a bit to large of an request. For an easier interface you could have a look at overpass turbo.

permanent link

answered 04 Feb '13, 08:38

Ohr's gravatar image

Ohr
10114
accept rate: 0%

As an example, here's what I did when I wanted all the railway stations in mainland GB. You'll need to think about what "place=" items you want to keep and amend accordingly. If you want Northern Ireland as well, then you'll need to include some from an Irish extract too - it might be worth asking another question about that.

1) osmconvert great_britain.osm.pbf -o=great_britain.o5m

2) osmfilter great_britain.o5m --keep="railway=station" > stations.osm

3) osmconvert stations.osm --all-to-nodes --csv="@id @lat @lon railway name" --csv=headline > stations.txt

4) Open stations.txt in your spreadsheet program of choice, and remove lines that don't have "station" in column D

Step (1) is needed because osmfilter doesn't understand pbf (protobuf format) files. You could process as a raw .osm file, but it'd be much bigger.

Step (4) is a sanity check to get rid of a few bits and pieces.

permanent link

answered 04 Feb '13, 08:53

SomeoneElse's gravatar image

SomeoneElse ♦
36.9k71370866
accept rate: 16%

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:

×315

question asked: 01 Feb '13, 16:15

question was seen: 4,532 times

last updated: 04 Feb '13, 08:53

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