Hey, you can I ask Overpass to just give me back Objects with just one particular tag and no other tags. e.g. if a object has the tag building=yes it should be displayed if it has building=yes and addr:city=whatever it shouldn't?

How can i make that happen ? Thanks for your answers!

asked 03 Jun '13, 20:05

hno2's gravatar image

accept rate: 0%

Update September 2014: Now that Overpass API also supports regular expressions for keys, this kind of query is now possible. See my answer below for details.

(10 Sep '14, 10:12) mmd

I don't know if overpass API can count tags. Neither do I know if you can query "your" objects.

If you are looking for buildings wighout house numbers, you could either use Simon's no address layer or you could use this overpass query (objects that have a building tag set and don't have an addr:housenumber tag):


HTH /al

permanent link

answered 04 Jun '13, 13:21

_al's gravatar image

accept rate: 4%


Thanks, I was looking for a query to find ways with addr:interpolation but without addr:street

(10 Oct '13, 20:17) cyph3r

Overpass API cannot count tags yet. There's an open issue for that on Github: https://github.com/drolbr/Overpass-API/issues/197

(22 Mar '15, 17:07) mmd

A combination of the difference operator and regular expressions for keys can make this happen. Unfortunately, you cannot use negative look-ahead (?!) for regular expressions, which makes the whole story very complex (see this stackoverflow post on how to build such an expression).

That's why I resort to a simplified approach and exclude buildings, which have any tags that don't start with a letter "b". However, the basic principle is the same.

// retrieve all buildings    
// and remove...    
// all buildings which also have a tag not starting with "b"    
); >; );

Try in Overpass Turbo: http://overpass-turbo.eu/s/4Z9

permanent link

answered 10 Sep '14, 09:02

mmd's gravatar image

accept rate: 37%

http://overpass-turbo.eu/s/rjM has an example of query that is using tag counting. It will find poorly tagged object - with only tourism=attraction or tourism attraction + name tag in Poland,

This has been generated by the overpass-turbo wizard.
The original search was:
“addr:housenumber=* and name=* and type:node and aeroway!=* and amenity!=* and craft!=* and historic!=* and leisure!=* and man_made!=* and office!=* and power!=* and railway!=* and shop!=* and tourism!=* in Polska”
[out:xml]/*fixed by auto repair*/[timeout:2500];
// fetch area “Polska” to search in
// gather results
  // query part for: “"addr:housenumber"=* and name=* and aeroway!=* and amenity!=* and craft!=* and historic!=* and leisure!=* and man_made!=* and office!=* and power!=* and railway!=* and shop!=* and tourism!=*”
// print results
out meta;/*fixed by auto repair*/
out meta qt;/*fixed by auto repair*/

query was provided by RicoElectrico, thanks! source: https://forum.openstreetmap.org/viewtopic.php?pid=661266#p661266

permanent link

answered 29 Aug '17, 08:58

Mateusz%20Konieczny's gravatar image

Mateusz Koni...
accept rate: 0%

edited 29 Aug '17, 08:59


I'm not sure what you mean.

Concerning the output format, Overpass API prints for an object always either all tags or no tags at all.

If you want to find an object with a certain tag but not a certain other tag, you can the solution provided by _al above.

permanent link

answered 05 Jun '13, 07:34

Roland%20Olbricht's gravatar image

Roland Olbricht
accept rate: 36%


As far as I understand he is looking for a solution to find objects which only have one tag - the specified tag - and no other tags at all.

(05 Jun '13, 08:14) scai ♦

Thats right, e.g a node with the tag addr:street: Obama Alley and without any other tags should be printed a node with addr:street and addr:country not. But I already solved my problem with an other possible solution

(05 Jun '13, 16:45) hno2
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



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:


question asked: 03 Jun '13, 20:05

question was seen: 6,019 times

last updated: 29 Aug '17, 08:59

powered by OSQA