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

0
1

Hi

I hacked at this OverPass Wiki example to find multi-polygon relations with just one member. The resulting routine seems to work but looks like it is running unnecessary steps. I've run out of knowledge. Is there anything I can do to tidy it up & make it run more efficiently?

rel({{bbox}})[type=multipolygon]->.relations;
foreach .relations -> .relation (
  (
   way(r.relation);
  )->.elem_all;

  rel.relation( if:elem_all.count(ways) == 1 );
  out geom;
);

OverpassTurbo Link

asked 19 Mar '18, 21:13

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%


There's a count_members evaluator that looks inside of each individual relation:

[bbox:{{bbox}}];
rel[type=multipolygon](if:count_members() == 1);
out geom;

http://overpass-turbo.eu/s/x9L

permanent link

answered 20 Mar '18, 00:32

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Ah, thank you. my Google search 'overpass count' wasn't specific enough to find it.

(20 Mar '18, 14:45) DaveF

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
×8

question asked: 19 Mar '18, 21:13

question was seen: 3,349 times

last updated: 20 Mar '18, 14:46

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