#10837 closed enhancement (fixed)
Some more validation rules for JOSM
Reported by: | naoliv | Owned by: | Klumbumbus |
---|---|---|---|
Priority: | normal | Milestone: | 14.12 |
Component: | Core validator | Version: | |
Keywords: | mapcss | Cc: |
Description (last modified by )
Good that you have included #10825 :-)
I have some more rules that we are using here that probably could be used everywhere else (and maybe you could be interested in including some of them in JOSM)
/* is using any other *_name tag but not a name */ *[/_name$/][!name] { throwWarning: tr("using alternative name without {0}", "{1.key}"); }
Done.
/* using nomame = yes + name is contradictory */ *[noname?][name] { throwWarning: tr("contradictory use of {0} and {1}", "{0.key}", "{1.key}"); }
Done.
/* follows http://wiki.openstreetmap.org/wiki/Proposed_features/drop_recommendation_for_place_name */ /* when name = place_name we just remove place_name */ *[place][place_name = *name] { throwWarning: tr("{0} = {1}; remove {0}", "{1.key}", "{1.value}"); fixRemove: "{1.key}"; } /* when it has place_name but not name, we rename place_name to name */ *[place][place_name][!name] { throwWarning: tr("do not use {0}", "{1.key}"); suggestAlternative: "name"; fixChangeKey: "{1.key} => {2.key}"; }
Done.
/* the highway "name" already define it's own address; it's strange to also have a "addr:street" on highways */ *[highway]["addr:street"] { throwWarning: tr("{0} should not have a {1} tag", "{0.key}", "{1.key}"); }
Done.
/* should use building:levels instead building + levels */ *[building][levels] { throwWarning: tr("use building:levels instead {0}", "{1.key}"); fixChangeKey: "levels => building:levels"; }
Done.
/* they shouldn't have a "yes" or "true" value */ *[amenity?], *[place?] { throwWarning: tr("unspecific value for {0}", "{0.key}"); }
Done.
/* lanes* must be an integer positive number only */ way[highway][lanes][lanes !~ /^[1-9]([0-9]*)$/], way[highway]["lanes:backward"]["lanes:backward" !~ /^[1-9]([0-9]*)$/], way[highway]["lanes:forward"]["lanes:forward" !~ /^[1-9]([0-9]*)$/] { throwError: tr("{0} must be a positive integer number", "{1.key}"); }
Done.
/* destination rules http://wiki.openstreetmap.org/wiki/Key:destination */ /* destination is "Worthwile only if used in combination with oneway=yes" */ way[destination][!oneway?] { throwWarning: tr("incomplete usage of {0}", "{0.key}"); suggestAlternative: "destination:forward"; suggestAlternative: "destination:backward"; }
Done.
Note that those tests were created for data that we were seeing here in Brazil but they aren't specific for here.
Some warning messages probably need a better wording.
Anything that could be useful for JOSM?
Attachments (0)
Change History (36)
comment:1 by , 10 years ago
Description: | modified (diff) |
---|
comment:2 by , 10 years ago
Milestone: | → 14.12 |
---|
comment:3 by , 10 years ago
comment:4 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 10 years ago
Description: | modified (diff) |
---|
comment:7 by , 10 years ago
/* lanes* must be an integer positive number only */ way[highway][lanes][lanes !~ /^[1-9]([0-9]*)$/], way[highway]["lanes:backward"]["lanes:backward" !~ /^[1-9]([0-9]*)$/], way[highway]["lanes:forward"]["lanes:forward" !~ /^[1-9]([0-9]*)$/] { throwError: tr("{0} must be a positive integer number", "{1.key}"); }
@team: is this fine in mapcss or better handled in a java validator test?
follow-up: 10 comment:8 by , 10 years ago
Hi, what about shop=yes ? I see it is used about 30000 times and has even a wiki page. But we could have an 'info' or 'warning' message about it. It seems discouraged to use it.
follow-up: 11 comment:9 by , 10 years ago
Should building:levels
also be tested for positive integer numbers?
comment:10 by , 10 years ago
Replying to aceman:
Hi, what about shop=yes ? I see it is used about 30000 times and has even a wiki page. But we could have an 'info' or 'warning' message about it. It seems discouraged to use it.
It's often used at amenity=fuel. It's even in the default preset.
edit: but I agree, this is not optimal
comment:11 by , 10 years ago
Replying to naoliv:
Should
building:levels
also be tested for positive integer numbers?
I think there can be half height storeys.
comment:13 by , 10 years ago
/* is using any other *_name tag but not a name */ *[/_name$/][!name] { throwWarning: tr("using alternative name without {0}", "{1.key}"); }
This test produces false positives for:
- old_name
- loc_name
- uic_name
comment:15 by , 10 years ago
comment:17 by , 10 years ago
Does feel to me like the right usage of old_name. Maybe disused:name=* would be better.
comment:19 by , 10 years ago
way/286295915 was part of the main street "Zschopauer Straße" before the trunk was built in the last years. Now it has become just a driveway without a name.
follow-up: 21 comment:20 by , 10 years ago
Since it's just a warning (and not an error), can't it be ignored by the user?
comment:21 by , 10 years ago
Replying to naoliv:
Since it's just a warning (and not an error), can't it be ignored by the user?
The most messages are warning level. And if there are too much false positives, people don't trust the validator and start ignoring the whole validator.
comment:23 by , 10 years ago
Description: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
comment:25 by , 10 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
The AssertMatches are failing. I don't know whats wrong there.
I think the regexp can be simplified to ^[1-9]\d*$
, but I don't know if this helps.
comment:29 by , 10 years ago
If you suggest keys like building:levels, the validator should not complain with:
Key building:levels not in presets. - Presets do not contain property key.
Same with building:part.
follow-up: 33 comment:32 by , 10 years ago
Replying to Klumbumbus:
In 8136/josm:
Think it should be building:part=*
with same values as building=*
.
follow-up: 34 comment:33 by , 10 years ago
Replying to skyper:
Replying to Klumbumbus:
In 8136/josm:
Think it should be
building:part=*
with same values asbuilding=*
.
Wiki and taginfo don't say this.
comment:34 by , 10 years ago
Replying to Klumbumbus:
Replying to skyper:
Think it should be
building:part=*
with same values asbuilding=*
.
Wiki and taginfo don't say this.
Right, it is only mention under Simple 3D Buildings. Taginfo is a bit difficult to interpret as e.g. building=roof
is special and if using aerials you often have to add several parts for one building and it is often not possible to determine the right value as even with a proper value of building=*
the value for the part might be different.
Miss building:part=balcony
.
comment:36 by , 10 years ago
Yeas I also agree and use building:part=<all the values from key:building>. Thanks for the fix.
This is already included. See [7697]