This is a static archive of our old OSM Help Site. Please post any new questions and answers at community.openstreetmap.org.

Determining if a given path goes through a park?

1

Is there a way to determine if a given path (e.g. footway) is part of/inside a park or a green space.

asked 08 Apr '13, 00:20

Sadeer's gravatar image

Sadeer
1768914
accept rate: 0%


One Answer:

3

Yes but you will have to do the required computation yourself. Import the OSM data into a spatial database (e.g. into PostGIS using osm2pgsql) and then if you want to know whether way #123 goes through a park you could write something like

select count(*) from planet_osm_polygon where leisure='park' and st_intersects(way, (select way from planet_osm_line where osm_id=123);

This returns the number of parks that the way leads through. Of course more complex queries are possible, e.g. find out what percentage of the way lies in a park, or whether a park lies in the vicinity of the way.

There is no ready-made online service that does such computations for you.

answered 08 Apr '13, 07:23

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%