Search code examples
openstreetmapoverpass-api

How to query overpass turbo by a tag with any value?


Catalonia has 42 'counties' which we call "comarques" (example). I am trying to retrieve its boundaries from OSM using overpass turbo. Using the query wizard, I have build the previous query:

/*
This has been generated by the overpass-turbo wizard.
The original search was:
“addr:country_code='ES' and admin_level=7”
*/
[out:json][timeout:25];
// gather results
(
  // query part for: “"addr:country_code"=ES and admin_level=7”
  node["addr:country_code"="ES"]["admin_level"="7"]({{bbox}});
  way["addr:country_code"="ES"]["admin_level"="7"]({{bbox}});
  relation["addr:country_code"="ES"]["admin_level"="7"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

This would render perfect results if it were not for 2 counties which have not been tag with addr:country_code and hence are not returned. Example.

I have observed, though, that all countries are tagged with idescat:comarca + int so I would like to use this tag (any value) in my query. I tried looking for idescat:comarca='.' but I did not yield any results. What am I doing wrong?


Solution

  • I found a way by simply typing idescat:comarca=* in the wizard. My initial approach idescat:comarca~“.*“ (regex) was for some reason not valid but the first works like charm!