Opened 9 years ago

Last modified 9 years ago

#10837 closed enhancement

Some more validation rules for JOSM — at Initial Version

Reported by: naoliv Owned by: team
Priority: normal Milestone: 14.12
Component: Core validator Version:
Keywords: mapcss Cc:

Description

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}");
}
/* using nomame = yes + name is contradictory */
*[noname?][name] {
        throwWarning: tr("contradictory use of {0} and {1}", "{0.key}", "{1.key}");
}
/* 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}";
}
/* 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}");
}
/* should use building:levels instead building + levels */
*[building][levels] {
        throwWarning: tr("use building:levels instead {0}", "{1.key}");
        fixChangeKey: "levels => building:levels";
}
/* they shouldn't have a "yes" or "true" value */
*[amenity?],
*[place?] {
        throwWarning: tr("unspecific value for {0}", "{0.key}");
}
/* 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}");
}
/* destination rules http://wiki.openstreetmap.org/wiki/Key:destination */
/* destination is "Worthwile only if used in combination with oneway=yes" */
way[destination][!oneway?][!waterway] {
        throwWarning: tr("incomplete usage of {0}", "{0.key}");
        suggestAlternative: "destination:forward";
        suggestAlternative: "destination:backward";
}

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?

Change History (0)

Note: See TracTickets for help on using tickets.