Modify

Opened 3 months ago

Closed 3 months ago

#14786 closed enhancement (fixed)

[Patch] Test for proper "ele" values

Reported by: naoliv Owned by: team
Priority: normal Milestone: 17.05
Component: Core validator Version:
Keywords: ele Cc:

Description

In https://wiki.openstreetmap.org/wiki/Key:ele we can see that ele is a numeric value that represents the elevation, in meters.

From #Local_Units we can assume that using units (even m for meter) is not needed (or is invalid).

If I am not lacking coffee, we have 8226 nodes, 3323 ways and 245 relations in OSM with an incorrect ele value http://overpass-turbo.eu/s/p0i

Is it useful to have this test in JOSM?

/* should be safe to just remove the meters unit from the value */
*[ele][ele =~ /^-?[0-9]+(\.[0-9]+)? ?m$/] {
        throwWarning: tr("{0} must be a numeric value, in meters and without units", "{0.key}");
        fixAdd: concat("ele=", trim(replace(tag("ele"), "m", "")));
        set .ele_is_fixed;
}

*[ele][ele !~ /^-?[0-9]+(\.[0-9]+)?$/]!.ele_is_fixed {
        throwWarning: tr("{0} must be a numeric value, in meters and without units", "{0.key}");
}

I am assuming that we can have negative values and that it's safe offer a fix to remove m from the value (for example, when ele=100m or ele=100 m)

Attached is also a small test case: nodes inside the green area should not receive any warning, nodes in orange should; nodes inside the yellow area are able to be automatically fixed.

Attachments (1)

testcase.osm (3.1 KB) - added by naoliv 3 months ago.

Download all attachments as: .zip

Change History (3)

Changed 3 months ago by naoliv

Attachment: testcase.osm added

comment:1 Changed 3 months ago by Don-vip

Keywords: ele added
Milestone: 17.05
Summary: Test for proper "ele" values[Patch] Test for proper "ele" values

comment:2 Changed 3 months ago by Klumbumbus

Resolution: fixed
Status: newclosed

In 12215/josm:

fix #14786 - Test for proper "ele" values (patch by naoliv)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.