Opened 9 years ago
Closed 9 years ago
#12053 closed enhancement (fixed)
Enhancement [PATCH] Add validation for mountain bike specific tags
Reported by: | Owned by: | team | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core validator | Version: | |
Keywords: | Cc: | Klumbumbus |
Description
When tagging the uphill difficulty of a mountain bike trail (i.e., a path), the OSM wiki defines that also the incline tag has to be present.
This patch adds a validator which checks that rule:
https://github.com/stefan-a-bauer/josm/commit/642af3430cf644eb6a3c1302931a045f92870bc5
https://github.com/stefan-a-bauer/josm/commit/642af3430cf644eb6a3c1302931a045f92870bc5.patch
Attachments (0)
Change History (6)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Can't it be done with MapCSS?
way["mtb:scale:uphill"][!incline] { throwWarning: tr("missing {0} tag in way", "{1.key}"); }
You could also create more MTB-specific rules and include them in https://josm.openstreetmap.de/wiki/Rules, if you want.
For example, you could also test for some wrong things:
way["mtb:scale:uphill"][highway][highway !~ /path|track/] { throwWarning: tr("{0} should be used only with highway=path or highway=track", "{0.key}"); } way["mtb:scale"]["mtb:scale" !~ /^[0-6]{1}$/] { throwWarning: tr("{0} must be a value between ''0'' and ''6''", "{0.key}"); } way["mtb:scale:uphill"]["mtb:scale:uphill" !~ /^[0-5]{1}$/] { throwWarning: tr("{0} must be a value between ''0'' and ''5''", "{0.key}"); } way["mtb:scale:imba"]["mtb:scale:imba" !~ /^[0-4]{1}$/] { throwWarning: tr("{0} must be a value between ''0'' and ''4''", "{0.key}"); }
comment:3 by , 9 years ago
Thanks for the pointer. I was thinking that such a check should be easily described in declarative style, but somehow MapCSS escaped my notice.
I will send a second proposal based on your example (which is a little too strict IMHO) soon.
comment:4 by , 9 years ago
Cc: | added |
---|
follow-up: 6 comment:5 by , 9 years ago
OK, here's my next proposal based on MapCSS:
https://github.com/stefan-a-bauer/josm-validators/blob/master/mtb.validator.mapcss
I applied only slight adaptions to naoliv's example. Integration into JOSM via the wiki works. With respect to this, the issue could be closed IMO.
BTW: How to provide translations for a validator which is integrated this way?
comment:6 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
BTW: How to provide translations for a validator which is integrated this way?
Add the appropriate xx.lang files. And then wait for #11392.
Can't it be done with MapCSS?
You could also create more MTB-specific rules and include them in https://josm.openstreetmap.de/wiki/Rules, if you want.
For example, you could also test for some wrong things: