Modify

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):

Therefore, I think that JOSM should warn users when this "rule" isn't met.

Attachments (0)

Change History (13)

comment:1 by gy-mate, 2 months ago

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!

in reply to:  1 ; comment:2 by skyper, 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 skyper, 2 months ago

Component: External ruleCore validator
Keywords: rule removed

as Osmose is mentioned it needs to be added to core

comment:4 by skyper, 2 months ago

Summary: Warn when addr:*=* is added to a relation[Patch] Warn when addr:*=* is added to a relation

comment:5 by Famlam, 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:

  1. Using tr to evaluate the {0} placeholder and allow translations
  2. 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:*=*");

in reply to:  2 comment:6 by gy-mate, 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 with assertMatch and assertNoMatch, see wiki:Help/Validator/MapCSSTagChecker

Thanks, I'll try them!

in reply to:  5 ; comment:7 by gy-mate, 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!

in reply to:  2 ; comment:8 by gy-mate, 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! :)

in reply to:  7 comment:9 by Famlam, 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:10 by gy-mate, 2 months ago

Good point—thanks!

in reply to:  8 comment:11 by skyper, 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:12 by taylor.smock, 8 weeks ago

Ticket #24082 has been marked as a duplicate of this ticket.

comment:13 by skyper, 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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to gy-mate.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.