Overpass Turbo: Culverts Under Highways

I’m trying to write an Overpass Turbo script that finds culverts that pass under a road. More specifically, where:

The culvert way has at least the tags:
tunnel=culvert
layer=-1

and the road way has at least the tag:
highway=*

So far I’ve got this with the help of ChatGPT:

[out:json][timeout:120];

// Find all ways tagged with tunnel=culvert and level=-1 within 50km of Blairgowrie, Scotland
way(around:50000, 56.5924, -3.3405)["tunnel"="culvert"]["level"="-1"]->.culvertWays;

// Find all ways tagged with highway=* within 50km of Blairgowrie, Scotland
way(around:50000, 56.5924, -3.3405)["highway"]->.highwayWays;

// Use proximity to find highway ways near culvert ways (within 30 meters)
way.culvertWays(around.highwayWays:30)->.culvertUnderHighway;

// Output the results
(way.culvertUnderHighway; >;);
out body;

Alas, this script gives no results in Overpass Turbo.
Can anyone assist?

You correctly mention the “layer” tag, but the query uses the “level” tag which is a different thing, normally used for building floors. That alone would explain the lack of output. I haven’t checked beyond that.

2 Likes

Keep in mind that sometimes tunnel=* might lack a layer-tag!

1 Like

Here is a simple query that outputs all tunnel=culvert crossing highway=* in the bounding box:
https://overpass-turbo.eu/s/1S08
I didn’t use layer=-1, because it is not seldom missing like PHerison said.
With layer=-1 it would be
https://overpass-turbo.eu/s/1S0a

Well, that was an embarrassing mistake - many thanks to all.

Awesome, many thanks for the solution and the education.

ChatGPT is a laugh. Everything it outputs should be checked by humans.

1 Like