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

In psql it's easy to do a query like "SELECT distinct name FROM planet_osm_polygon WHERE (boundary = 'national_park');" to return the names of national parks from a database. What's the equivalent in Overpass Turbo?

Various area selection methods exist such as "geocodeArea:Great Britain}}->.searchArea" followed by adding "(area.searchArea)" before the semicolon, but let's assume for now that a simple "({{bbox}})" query would work.

The link from taginfo, once I've commented out nodes and ways and added "({{bbox}})" gets me to https://overpass-turbo.eu/s/11DZ , but that's a visual query - I don't want the constituent ways, I don't want a map and I want a list of unique names (actually, to start with, just the number of items in the list).

There are some pages linked from https://wiki.openstreetmap.org/wiki/Overpass_turbo , but a search suggests there's nothing directly useful to me there.

asked 28 Dec '20, 17:17

SomeoneElse's gravatar image

SomeoneElse ♦
36.9k71370866
accept rate: 16%


This might not cover the DISTINCT bit, but change the top of your query from [out:json] to something like the example below?

[out:csv("name")][timeout:25];
// gather results
(
  // query part for: “protect_class=5”
  //node["protect_class"="5"]({{bbox}});
  //way["protect_class"="5"]({{bbox}});
  relation["protect_class"="5"]({{bbox}});
);
// print results
out body;
>;
out skel qt;
permanent link

answered 28 Dec '20, 18:32

EdLoach's gravatar image

EdLoach ♦
19.5k16156280
accept rate: 22%

Actually it's good enough, because very few AONBs have separate outer polygons - of the ones in the rendering database, just the Forest of Bowland I think.

I'll work through the list of discrepancies to see if there are any obvious relation issues with the "missing" ones.

(28 Dec '20, 19:02) SomeoneElse ♦

This is what I use:

// CSV list of National Parks 
[out:csv(::id, "name",::count; false; ",")];
area(id:3600058447,3600058437,3600058446); //EWS
rel(area)[boundary=protected_area][designation=national_park];
out;
out count;

Note the value change of the boundary tag from national_park to protected_area.

Also, ISO3166-1"="GB" would return data from Northern Island, if there were any, which is why I specify the ids for England, Wales & Scotland.

PS {{geocodeArea:Great Britain}}, for some reason, excludes GB's islands such as Sky, Isle of Wight & Sheppy; something I mean to bring up on Talk-GB.

permanent link

answered 05 Jan '21, 13:42

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

edited 05 Jan '21, 13:53

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:

×228

question asked: 28 Dec '20, 17:17

question was seen: 2,006 times

last updated: 05 Jan '21, 13:53

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