This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Query tags of relation (in commandline)

2

I've got a list of relations of power plants and would like to query the "plant:output:electricity" tag.

Is there any generic tool (for Linux commandline) which queries the content of an arbitrary tag from Overpass?

So e.g. I would like to do:

./querytool -relation 368946 -tag "plant:output:electricity"

and get out "150 MW".

Thanks for any help!

asked 29 Apr '18, 11:34

landuse's gravatar image

landuse
1165511
accept rate: 0%

Why are you not answering?

(01 May '18, 11:43) landuse
1

I’m still trying to find an answer for you.

(01 May '18, 12:00) nevw
2

@landuse please be polite. All answers are provided by volunteers in their free time and you have no "right" to an answer in any form.

(01 May '18, 15:35) SimonPoole ♦

One Answer:

5

It's not a ready made tool, but you can pipe curl into something like jq:

curl -s -g http://overpass-api.de/api/interpreter --data-urlencode 'data=[out:json];rel(368946);out;' | jq '.elements[0].tags."plant:output:electricity"'

I guess that won't work well if you want a lot of flexibility, but for simple queries it should be fine.

answered 01 May '18, 14:27

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Source code available on GitHub .