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

I am trying to output a map of British Columbia's regional districts using the Overpass API. I tried the following code on overpass-turbo.eu, and got a bit of a messy map.

[out:json][timeout:90];
(
relation[admin_level=6](area:3600390867);
);
out body;
>;
out skel qt;

What I want to do is hide all of those single nodes that have roles in each of these relations, i.e., I want to see each multipolygon area depicted in yellow, but I want to hide the nodes that have "admin_centre" and "label" roles. I have not figured out a way to do this. Can anyone help?

asked 15 Aug '20, 00:59

DENelson83's gravatar image

DENelson83
18114
accept rate: 0%


This is closer. There's an Overpass Turbo map setting to not show the small areas as nodes, which gets even closer.

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

[out:json][timeout:90];
(
relation[admin_level=6](area:3600390867);
);
out body;
way(r);
(._;>;);
out skel qt;
{{style:
area{
  color:#e99;
  width:2;
  opacity:0.8;
  fill-color:#c77;
  fill-opacity:0.3;
}
}}

The OSM data is output in a few pieces here. out body; emits the relation data. Then only the way members of the relations are retrieved by way(r); (as in the other answer). Then the nodes needed to draw those ways are retrieved by (._;>;);. The ways and nodes are then emitted in out skel qt;. Using out skel; doesn't emit tags, so the nodes and ways output in that line are only used to construct the relation geometries, they aren't also interpreted as features in their own right. I put the {{style::...}} directive in there to show it was possible to adjust the display, if you like the default colors, just delete that part.

permanent link

answered 19 Aug '20, 01:57

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

edited 19 Aug '20, 01:58

Wow! That is much cleaner. I was unaware that overpass-turbo allows for CSS fine-tuning of its output. Thank you for pointing this out.

(19 Aug '20, 04:58) DENelson83
rel[admin_level=6](area:3600390867);
way(r);
out geom;

https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Recurse_.28n.2C_w.2C_r.2C_bn.2C_bw.2C_br.29

Tip: to receive more answers add 'overpass' to the the tags list when asking a Q.

permanent link

answered 17 Aug '20, 12:13

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

Except that looks even more hideous when depicted on overpass-turbo.eu, and none of the areas get coloured yellow.

(17 Aug '20, 22:41) DENelson83

Sorry I spoke. You clearly think you know best. You're on you own.

(18 Aug '20, 14:20) DaveF
Your answer
toggle preview

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:

×132
×128
×92

question asked: 15 Aug '20, 00:59

question was seen: 1,432 times

last updated: 19 Aug '20, 04:59

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