Opened 2 months ago
Last modified 7 weeks ago
#24078 new enhancement
[Patch] Warn when addr:*=* is added to a relation
Reported by: | gy-mate | Owned by: | team |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Core validator | Version: | |
Keywords: | addr, relation | Cc: |
Description
This is an issue moved from https://github.com/osm-fr/osmose-backend/issues/2429.
addr:*=*
tags are not allowed on relations (except multipolygon relations):
- https://wiki.openstreetmap.org/wiki/Key:addr:*#:~:text=Used%20on%20these%20elements
- https://wiki.openstreetmap.org/wiki/Talk:Key:addr:*#on_relations
Therefore, I think that JOSM should warn users when this "rule" isn't met.
Attachments (0)
Change History (13)
follow-up: 2 comment:1 by , 2 months ago
follow-ups: 6 8 comment:2 by , 2 months ago
Are addresses on type=site
relations forbidden? I can think of a site which covers several areas with different addresses but has a single main address.
Replying to gy-mate:
I've created https://josm.openstreetmap.de/wiki/Rules/AddrRelationWarning as a possible fix.
Nice way to make a patch available but due to the slow updates cased by caching and the possible short life time of this external rule a simple patch file or just the code in a comment would have been sufficient.
For presets, we have wiki:Presets/NewTags. Maybe we could think about a similar wiki:Rules/NewRules to collect some short rules and have a place for testing new rules.
Please check if I've done it correctly! Thanks in advance!
You expression does not work. You can always test if the result is met with the search function in expert mode by choosing MapCSS selector
as Search syntax (bottom left). Additionally, unit test are possible with assertMatch
and assertNoMatch
, see wiki:Help/Validator/MapCSSTagChecker
You can add a group=
and use common core groups even in external rules. I.e. adding group: tr("suspicious tag combination");
would be fine.
How about following?:
relation[type][type!~/multipolygon|site/][/^addr:.*/] { throwWarning: "addr:*=* tags on {0} relations", "{0.value}"; group: tr("suspicious tag combination"); assertMatch: "relation type=boundary addr:street=1"; assertNoMatch: "relation type=multipolygon addr:street=1"; }
comment:3 by , 2 months ago
Component: | External rule → Core validator |
---|---|
Keywords: | rule removed |
as Osmose is mentioned it needs to be added to core
comment:4 by , 2 months ago
Summary: | Warn when addr:*=* is added to a relation → [Patch] Warn when addr:*=* is added to a relation |
---|
follow-up: 7 comment:5 by , 2 months ago
May I recommend:
relation[type][type!~/^(multipolygon|site)$/][/^addr:./] { throwWarning: tr("addr:*=* tags on a {0} relation", "{0.value}"); group: tr("suspicious tag combination"); assertMatch: "relation type=boundary addr:street=1"; assertNoMatch: "relation type=multipolygon addr:street=1"; }
The changes from the patch of skyper are:
- Using
tr
to evaluate the{0}
placeholder and allow translations - Giving the regex an earlier stop (
^
and$
means it doesn't need to search further, and not using.*
prevents it from continuing matching)
However, one could also consider to re-use the existing i18n string and avoid creating new strings for translating:
throwWarning: tr("{0} on a relation", "addr:*=*");
comment:6 by , 2 months ago
Replying to skyper:
Are addresses on
type=site
relations forbidden?
They are, according to the wiki: https://wiki.openstreetmap.org/wiki/Key:addr:*#:~:text=Used%20on%20these%20elements
I can think of a site which covers several areas with different addresses but has a single main address.
There was a chat about this at https://wiki.openstreetmap.org/wiki/Talk:Key:addr:*#on_relations. I suggest you keep the discussion going there.
Nice way to make a patch available but due to the slow updates cased by caching and the possible short life time of this external rule a simple patch file or just the code in a comment would have been sufficient.
You expression does not work.
I'm sorry about these!
You can always test if the result is met with the search function in expert mode by choosing
MapCSS selector
as Search syntax (bottom left). Additionally, unit test are possible withassertMatch
andassertNoMatch
, see wiki:Help/Validator/MapCSSTagChecker
Thanks, I'll try them!
follow-up: 9 comment:7 by , 2 months ago
Replying to Famlam:
However, one could also consider to re-use the existing i18n string and avoid creating new strings for translating:
throwWarning: tr("{0} on a relation", "addr:*=*");
So something like this?
relation[type][type!~/^multipolygon$/][/^addr:./] { throwWarning: tr("{0} on a relation", "addr:*=*"); group: tr("suspicious tag combination"); assertMatch: "relation type=boundary addr:housenumber=1"; assertNoMatch: "relation type=multipolygon addr:housenumber=1"; }
I removed the type!=site
filter to make it adhere to the wiki and changed the assertMatch
and assertNoMatch
addr:street
keys to addr:housenumber
(as the numerical value suggests). I've also tested this with JOSM's Search function—it works!
follow-up: 11 comment:8 by , 2 months ago
Replying to gy-mate:
I've created https://josm.openstreetmap.de/wiki/Rules/AddrRelationWarning as a possible fix.
Nice way to make a patch available but due to the slow updates cased by caching and the possible short life time of this external rule a simple patch file or just the code in a comment would have been sufficient.
Can someone delete that wiki page (if necessary)? Thanks! :)
comment:9 by , 2 months ago
Replying to gy-mate:
So something like this?
Yes, although if it's only a single type
that's excluded I'd just use a simple !=
, without regex:
relation[type][type!=multipolygon][/^addr:./] { throwWarning: tr("{0} on a relation", "addr:*=*"); group: tr("suspicious tag combination"); assertMatch: "relation type=boundary addr:housenumber=1"; assertNoMatch: "relation type=multipolygon addr:housenumber=1"; }
comment:11 by , 8 weeks ago
Replying to gy-mate:
Replying to skyper:
Are addresses on
type=site
relations forbidden?
They are, according to the wiki: https://wiki.openstreetmap.org/wiki/Key:addr:*#:~:text=Used%20on%20these%20elements
The wiki can be wrong and it usually should reflect the usage. In general, it is better to rely on more sources than only the wiki page.
I can think of a site which covers several areas with different addresses but has a single main address.
There was a chat about this at https://wiki.openstreetmap.org/wiki/Talk:Key:addr:*#on_relations. I suggest you keep the discussion going there.
My experiences show that "Talk" pages on the wiki are the least productive discussions and that get far more responses on the forum or the mailing lists, these days.
Replying to gy-mate:
Replying to gy-mate:
I've created https://josm.openstreetmap.de/wiki/Rules/AddrRelationWarning as a possible fix.
Nice way to make a patch available but due to the slow updates cased by caching and the possible short life time of this external rule a simple patch file or just the code in a comment would have been sufficient.
Can someone delete that wiki page (if necessary)? Thanks! :)
For the time being, we can keep it, until the patch is accepted. Though, it should be fixed.
The most effective way to get ride of a JOSM ticket, a JOSM wiki page or an attachment on a page, is to report it as "spam" (most right on the lowest line of the header of each page if logged in) and leave a comprehensive comment.
comment:13 by , 7 weeks ago
How about street
and associatedStreet
relations? At least some addr:*=*
might be valid.
By the way, I fixed the external rule to get rid of the integration test failure.
I've created https://josm.openstreetmap.de/wiki/Rules/AddrRelationWarning as a possible fix.
Please check if I've done it correctly! Thanks in advance!