drolbr / Overpass-API

A database engine to query the OpenStreetMap data.
http://overpass-api.de
GNU Affero General Public License v3.0
690 stars 90 forks source link

way_cnt and closed ways #697

Closed mmd-osm closed 11 months ago

mmd-osm commented 11 months ago

According to the wiki page: _The way_cnt criterion selects those nodes that are members of a given number of ways. E.g. the criterion (waycnt:2) selects all crossings between ways and all nodes where two ways join.

I tested this using closed ways (building), and results look a bit unexpected.

This is what the query returns:

image

I would expect the following result according to the Wiki description:

Note that the result doesn't contain closed ways where the front and back node belong to the same way.

image

Query:

[bbox:51.3424588108006,6.277366876602173,51.345114369370336,6.2813955545425415];
way[building];
node(way_cnt:2);
out;

I believe every node belonging to the same way may only be counted once, i.e. we need to calculate the list of distinct node ids for each way: https://github.com/mmd-osm/Overpass-API/commit/fd23189f055aa3f062b138013546d09d531571f9

drolbr commented 11 months ago

Thank you for reporting the issue. Fixed in b40422fd8d2f6fa6753a734e4b69455d33979a92