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

1
1

I'd like to find multipolygons that have more than one member with the role 'outer'.

Is there a way to do that with the Overpass API, or would I have to wait for https://github.com/drolbr/Overpass-API/issues/197 to get written?

Would there be any other way to do this?

asked 10 Dec '16, 01:16

Stereo's gravatar image

Stereo
3562513
accept rate: 11%


If you are willing to put up with a beta quality program I am working on, you can use osmium-filter. It can do a query like that: osmium-filter-simple INPUTFILE -e '@relation and (@members[@role=="outer"] > 1)' -o OUTPUTFILE. It doesn't support giving you all the ways and nodes needed for these relations yet, if you need that, you can use the Osmium tool (to be more exact, osmium getid). Other options include writing your own program using libosmium, PyOsmium, or node-osmium (see http://osmcode.org/).

permanent link

answered 10 Dec '16, 09:30

Jochen%20Topf's gravatar image

Jochen Topf
5.2k55074
accept rate: 31%

edited 10 Dec '16, 09:34

Thank you Jochen, I'll give that a go!

Would you also happen to have a way of finding old-style multipolygons with it?

(10 Dec '16, 12:56) Stereo
1

Have a look at https://github.com/osmcode/osm-area-tools . There are tools that can find old-style multipolygons. I use that to create the overlay on http://area.jochentopf.com/map/index.html for instance. But you can also just download the old-style mps from http://area.jochentopf.com/ updated daily.

(10 Dec '16, 14:36) Jochen Topf

Wow, osmium-filter is impressively fast! It's an exciting tool, and I hope that you'll find time to document it :).

'@relation and "type"="multipolygon" and (@members[@role=="outer"] > 1)' did the trick.

(10 Dec '16, 14:38) Stereo

I ended up doing it in overpass:

[out:xml][timeout:25];
{{geocodeArea:Luxembourg}}->.searchArea;
// gather results
(
  relation["type"="multipolygon"](if: count_by_role("outer") > 1 )(area.searchArea);
  relation["type"="multipolygon"](if: count_members() == 1 )(area.searchArea);

);
// print results
out meta;
>;
out meta qt;
permanent link

answered 09 May '21, 21:44

Stereo's gravatar image

Stereo
3562513
accept rate: 11%

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:

×483
×236
×132

question asked: 10 Dec '16, 01:16

question was seen: 2,822 times

last updated: 09 May '21, 21:44

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