Opened 7 years ago

Closed 7 years 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:


In 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

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 7 years ago.

Download all attachments as: .zip

Change History (3)

by naoliv, 7 years ago

Attachment: testcase.osm added

comment:1 by Don-vip, 7 years ago

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

comment:2 by Klumbumbus, 7 years ago

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
as closed The owner will remain team.
as The resolution will be set.
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.