Search code examples
openstreetmapoverpass-api

Overpass only filter polygons (Overpass standalone)


I have a code for a challenge in Maproulette for Runways that are shaped as a polygon (not as a line).

this is Overpass code for making geoJSON file:

    [timeout:25];
area(3600304938)->.searchArea;
(
  way["aeroway"="runway"](area.searchArea);
);
out body geom qt;

Now the problem is Overpass filters all of runways for me (Polygon shaped and line shaped) , but I only want polygon shaped runways to load for me.

what should I do?

thanks


Solution

  • Unfortunately, checking for closed ways is currently not yet implemented, i.e. there's nothing you can do about this without further post processing, except for creating an enhancement request on Github maybe: https://github.com/drolbr/Overpass-API/issues

    Edit: with the forthcoming version 0.7.55 you could count the number of members contained in a way and compare it with the number of distinct members. In case of a closed way, the first and last node will typically point to the same node id (that's why it's a closed way in the first place), hence we could use this difference of 1 between both values for a query.

    Please note that there may be cases, where this heuristic does not work. That's why I still recommend to create an enhancement request for a proper closed way check. In your query area, I didn't find such cases though:

    [timeout:25];
    area(3600304938)->.searchArea;
    
    way["aeroway"="runway"](area.searchArea)(if:count_distinct_members() + 1 == count_members());
    
    out body geom qt;
    

    overpass turbo link: http://overpass-turbo.eu/s/qLQ