Modify

#23781 closed task (fixed)

[patch] Convert existing MapCSS rules to use the new siunit_length() function

Reported by: gaben Owned by: team
Priority: minor Milestone: 24.07
Component: Core validator Version:
Keywords: unit conversion SI Cc: Famlam

Description

The function is available since r19089.

Requested by Famlam in ticket:23621#comment:24.

Change History (9)

comment:1 by Famlam, 11 months ago

Well, requested... suggested :)

The only two I saw so far are:
1) the one linked in the initial post of this ticket
2) the way[highway=pedestrian][width][width<3] check in combinations.mapcss

comment:2 by gaben, 11 months ago

The patch so far:

  • TabularUnified resources/data/validator/combinations.mapcss

    diff --git a/resources/data/validator/combinations.mapcss b/resources/data/validator/combinations.mapcss
    a b  
    756756}
    757757
    758758/* #17391 */
    759 way[highway=pedestrian][width][width<3] {
     759way[highway=pedestrian][width][siunit_length(tag(width))<3] {
    760760  throwWarning: tr("{0} together with {1}", "{0.tag}", "{1.tag}");
    761761  suggestAlternative: "highway=footway";
    762762  group: tr("suspicious tag combination");
  • TabularUnified resources/data/validator/numeric.mapcss

    diff --git a/resources/data/validator/numeric.mapcss b/resources/data/validator/numeric.mapcss
    a b  
    6767  assertNoMatch: "node building:levels=0"; /* valid because there can be building:levels:underground > 0 or roof:levels > 0 */
    6868}
    6969
    70 *[roof:height][roof:height =~ /^0*(\.0*)?( (m|ft))?$/][roof:shape=flat] {
     70*[roof:height][siunit_length(tag("roof:height")) == 0][roof:shape=flat] {
    7171  throwWarning: tr("{0} is unnecessary for {1}", "{0.tag}", "{2.tag}");
    7272  group: tr("unnecessary tag");
    7373  fixRemove: "{0.key}";

comment:3 by gaben, 11 months ago

Summary: Convert existing MapCSS rules to use the new siunit_length() function[patch] Convert existing MapCSS rules to use the new siunit_length() function

comment:4 by gaben, 11 months ago

I'd like to run through the files before assigning a milestone, so if anyone find a candidate, just ping me and I'll add it to the patch.

comment:5 by Famlam, 11 months ago

I'd like to run through the files before assigning a milestone, so if anyone find a candidate, just ping me and I'll add it to the patch.

Another candidate (at the bottom of combinations.mapcss)

area[/^(building|building:part)$/][height =~ /^[0-9]+(\.[0-9]+)?( m)?$/][min_height =~ /^[0-9]+(\.[0-9]+)?( m)?$/][get(split(" ", tag(height)), 0) <= get(split(" ", tag(min_height)), 0)],

Probably (untested) something like:

area[/^(building|building:part)$/][height][min_height][siunit_length(tag(height)) <= siunit_length(tag(min_height))],

by gaben, 11 months ago

Attachment: 23781.patch added

comment:6 by Famlam, 11 months ago

For what it's worth: I didn't find other ones so I think the patch is complete now

comment:7 by gaben, 11 months ago

Milestone: 24.07

I'm on vacation right now, but the patch should be okay.

comment:8 by stoecker, 11 months ago

Resolution: fixed
Status: newclosed

In 19140/josm:

adapt height rules to use siunit_length - patch by gaben, fix #23781

Add Comment


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