Skip to content
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

Do not ask AddAddressStreet quest if addr:substreet or addr:parentstreet are present #4490

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class AddAddressStreet : OsmElementQuestType<StreetOrPlaceName> {

private val filter by lazy { """
nodes, ways, relations with
(addr:housenumber or addr:housename) and !addr:street and !addr:place and !addr:block_number
or addr:streetnumber and !addr:street
(addr:housenumber or addr:housename) and !addr:street and !addr:place and !addr:block_number and !addr:substreet and !addr:parentstreet
or addr:streetnumber and !addr:street and !addr:substreet and !addr:parentstreet
westnordost marked this conversation as resolved.
Show resolved Hide resolved
""".toElementFilterExpression() }

// #2112 - exclude indirect addr:street
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ class AddAddressStreetTest {
assertEquals(false, questType.isApplicableTo(addr))
}

@Test fun `not applicable to place with substreet name`() {
val addr = node(tags = mapOf(
"addr:housenumber" to "123",
"addr:substreet" to "onetwothree",
))
val mapData = TestMapDataWithGeometry(listOf(addr))
assertEquals(0, questType.getApplicableElements(mapData).toList().size)
assertEquals(false, questType.isApplicableTo(addr))
}

@Test fun `not applicable to place with parentstreet name`() {
val addr = node(tags = mapOf(
"addr:housenumber" to "123",
"addr:parentstreet" to "onetwothree",
))
val mapData = TestMapDataWithGeometry(listOf(addr))
assertEquals(0, questType.getApplicableElements(mapData).toList().size)
assertEquals(false, questType.isApplicableTo(addr))
}

@Test fun `not applicable to place without street name but in a associatedStreet relation`() {
val addr = node(1, tags = mapOf("addr:housenumber" to "123"))
val associatedStreetRelation = rel(
Expand Down