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

15
5

Is it possible, say, for an independent developer to extract a list of "landmarks" (churches, museums, squares, ...) from OSM? (Question originally asked on IRC)

asked 07 Jul '10, 10:34

Richard's gravatar image

Richard ♦
30.9k44279412
accept rate: 18%


OpenStreetMap has millions of points of interest which will serve you well for this. These are "nodes" (points) each tagged with a set of keywords that indicate what each point is. For example, you might have a node with latitude 51.398, longitude -1.082, and tags amenity=place_of_worship, name=St Mary's Church. This indicates that there's a church called St Mary's Church at that lat and long.

So you need to get this data out of OSM. The first step is to identify which tags you're interested in. You might want, for example, everything tagged as a church: in other words, everything with amenity=place_of_worship. (The first part of the tag is the 'key', the second the 'value'. You can see a long list of common OSM tags on our wiki.)

There are two ways you can get this data out of the OSM database.

One is by using Overpass, a separate API with a powerful query language which allows you to fetch data matching certain tags.

The second is to download the OpenStreetMap data dump and filter it according to your needs. The data dump is called planet.osm. You can either download the whole world (really huge), or just an extract covering one country or state.

Once you've downloaded it, you can use Osmosis or Osmfilter to extract the data for you, and output it into a file. Alternatively, you can load all the data into a local database with Osmosis or osm2pgsql, and then query the database for the features you want.

permanent link

answered 07 Jul '10, 10:49

Richard's gravatar image

Richard ♦
30.9k44279412
accept rate: 18%

edited 08 May '20, 15:55

3

Especially in well-mapped parts of the world, points of interest may also be available as "areas" (closed sequences of nodes) instead of nodes. The tags are the same as you would find on nodes, but if you want a single latitude/longitude pair you need to calculate it from the area outline!

(10 Jul '10, 13:19) Tordanik

I posted a follow-up question that outlines the process of filtering specific data from a planet file. It may contain information useful to those interested in this topic. Also, I hope to get best practices on how to keep a POI database up-to-date once you have it set up, which is what my question is about.

permanent link

answered 25 Mar '11, 10:23

mvexel's gravatar image

mvexel
76281523
accept rate: 0%

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:

×230
×181

question asked: 07 Jul '10, 10:34

question was seen: 102,423 times

last updated: 08 May '20, 15:55

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