I am looking to check if all nodes of a way are near a gpx track. Therefore, I have valid nodes which is the result of an around query on .item_nodes with the gpx track. And my .item_nodes which are the nodes of a way i am checking.
I want to check that more than 60% of the way's nodes are near the gpx track. Therefore I used a .r set with two tags : valid and item and I want to compare them but it does not work.
The only thing that works is setting a difference of set between .valid_nodes and .item_nodes and checking that the difference is 0 but then I cannot compare with a pourcentage of the size of the set...
Here is my code
.valid_nodes -> ._;
out count;
make count valid = count(nodes)-> .p; //debug
.item_nodes -> ._;
make count item = count(nodes)-> .q; //debug
(.p; .q;)->.r;
.r out;
//(.item_nodes; - .valid_nodes;) -> ._;
(
.r;
if (t["valid"] > 0.6*t["item"])
(
(.matching_items_bridges; .item;) -> .matching_items_bridges;
)
)
)
And here is the current working code:
(.item_nodes; - .valid_nodes;) -> ._;
if (count(nodes) == 0)
(
(.matching_items_bridges; .item;) -> .matching_items_bridges;
)