Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ask "Is this inside a building" #5248
Ask "Is this inside a building" #5248
Changes from 3 commits
93c005f
1848f18
0ca2f37
b1c613e
c035cdf
a0d0e45
3a5932f
25128cd
6b31bda
f350d62
df65c34
1681194
5f167b9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A further performance improvement would be possible here.
Currently for every node, you check if it is contained within any building that is near one of these nodes.
You could also reduce the
nodes
beforehand that are not near any building. (add all nodes near buildings to a set and then only iterate through these instead of allnodes
)However, probably not worth it because I guess there are not that many "small amenity nodes" looking at the filter you wrote, so not required for this PR to be merged. Just wanted to note this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isApplicableTo
is called also offline for any element that is updated due to the user changing it.So for example when you solve the building quest, the app subsequently checks with this function whether for the new version of the building any new quests apply. In this case, the building levels quest will return true here, so a new quest is created.
Now, this means for your implementation here that if any e.g.
amenity=atm
is updated through any other quest (e.g. checking whether it is still there), the method here will always return true, ie.e. theAddIsAmenityIndoor
quest is created. We do not want that.In fact, as long as we do not have any information about the surrounding buildings, we cannot answer whether it applicable or not. Or well, if the given element does not match the
nodesFilter
or does not have any name, then we can say that it is not applicable, but otherwise, we can't tell. In this case, we want to returnnull
.Also have a look at for example the housenumber quest as it also depends on the surrounding building geometry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, i'm not sure if i understand this right.
Would it just be
override fun isApplicableTo(element: Element) { if (!nodesFilter.matches(element) || !hasAnyName(element.tags)) false else null }
or should i think of a more complex filtering?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this function, yes. However, you use this function also in
getApplicableElements
, so there you should probably inlinenodesFilter.matches(element) && hasAnyName(element.tags)