#11234 closed enhancement (fixed)
Validator should warn when key is # or +
Reported by: | daganzdaanda | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 15.04 |
Component: | Core validator | Version: | tested |
Keywords: | mistyped key | Cc: | lists@… |
Description
I've just been fixing a number of buildings that had a #=yes tag. ( https://www.openstreetmap.org/changeset/29472433 )
I tested adding this to a building, and the validator did not complain when I uploaded it.
Most probably these keys come from missing the "Enter" key on a German keyboard. I imagine that in the same way one could arrive at "+" as a key. There is no warning message for "+" as well.
Could you add a warning when there is a key "#" or "+"?
Maybe other keyboard layouts could be taken into account, too. Or be even more general and warn about all single letter keys, or keys with special letters apart from ":" and "_"
Attachments (0)
Change History (19)
comment:1 by , 9 years ago
Milestone: | → 15.03 |
---|---|
Type: | defect → enhancement |
follow-up: 3 comment:2 by , 9 years ago
follow-ups: 5 6 comment:4 by , 9 years ago
There are:
- ID - not documented, looks like some local imports on taginfo map
- Id - not documented
- kp - replaced by distance
- pk - replaced by distance
- to - used in public transport routes (from=* to=*)
So I think we could warn with "short key" for all keys with 2 or less characters except "to".
comment:5 by , 9 years ago
Replying to Klumbumbus:
There are:
- ID - not documented, looks like some local imports on taginfo map
- Id - not documented
- kp - replaced by distance
- pk - replaced by distance
- to - used in public transport routes (from=* to=*)
So I think we could warn with "short key" for all keys with 2 or less characters except "to".
Maybe allow "id" in lowercase too.
At the other side we should also issue a warning for extra long keys (>55 chars). The longest key I find somewhat acceptable is railway:milestone:emergency_brake_override:direction
(52 chars)
comment:7 by , 9 years ago
Replying to Klumbumbus:
Someone has the regexp for the counts at hand?
Or could we use the length()
expression?
comment:8 by , 9 years ago
For character test I have this:
*[/=|\+|\/|&|<|>|;|'|"|%|#|@|\\|,|\./] { throwWarning: tr("key with uncommon character"); }
?
|
and {
do not work, they produce exceptions in the console, even with leading \
Any improvements to this?
follow-up: 10 comment:9 by , 9 years ago
Keys should not have any whitespace, so maybe check for the various possible spaces?
Would a check for unicode ranges be sensible? Either positive or negative?
This is a good overview of what's out there:
http://taginfo.openstreetmap.org/reports/characters_in_keys
comment:10 by , 9 years ago
Replying to daganzdaanda:
Keys should not have any whitespace, so maybe check for the various possible spaces?
There is already a test for white spaces.
comment:11 by , 9 years ago
The charadcter count somehow does not work. I tried the following (and a hundred other possibilities):
*[/.{1,2}/] { throwWarning: tr("uncommon short key"); }
*[/.?.?/] { throwWarning: tr("uncommon short key"); }
What's wrong?
comment:12 by , 9 years ago
Milestone: | 15.03 → 15.04 |
---|
comment:13 by , 9 years ago
Cc: | added |
---|
comment:15 by , 9 years ago
follow-up: 18 comment:16 by , 9 years ago
@Klumbumbus:
Please open a defect ticket for the MapCSS issues you found and close this.
comment:17 by , 9 years ago
Are those keys with Chinese characters valid? Is there a rule for keys only being a-z0-9 or something?
comment:18 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
# has 43 uses and + has 82. So I don't think we need special tests for those, but we can test for uncommon characters in general (which would include # and + then). Also the test for keys which are one character long sounds good. Are there keys with 2 characters?