Search code examples
filtergisoverpass-api

Filter Overpass API results to include results with tags


Starting out with the Overpass API. Trying to output only results that have information within the "tags" output.

[out:json][timeout:25];

(
  node(around:50,24.650260, 46.708768);
  way(around:50,24.650260, 46.708768);
  rel(around:50,24.650260, 46.708768);
);
out meta qt;

Link to output data is here

The Overpass API seems to allow filtering to specific items within the "tags" element, such as 'name', but not to be able to filter out elements with no tag.


Solution

  • You seem to be able to filter on the number of tags, e.g.

    [out:json][timeout:25];
    
    (
      node(around:50,24.650260, 46.708768)(if: count_tags() > 0);
      way(around:50,24.650260, 46.708768)(if: count_tags() > 0);
      rel(around:50,24.650260, 46.708768)(if: count_tags() > 0);
    );
    
    out meta qt;
    

    Try it on http://overpass-turbo.eu/s/EpZ