Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#20957 closed defect (fixed)

Automatic fix for "Unnecessary amount of decimal places" results in NaN

Reported by: riiga_92@… Owned by: simon04
Priority: normal Milestone: 21.05
Component: Core validator Version:
Keywords: template_report mapcss expression factory regression Cc: Klumbumbus

Description

What steps will reproduce the problem?

  1. Have a node with the ele tag that has unnecessary precision, e.g. 75.969999999999999
  2. Run validator to get the warning
  3. Click "Fix" for that warning

What is the expected result?

ele with rounded number

What happens instead?

ele gets the value NaN

Please provide any additional information below. Attach a screenshot if possible.

URL:https://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2021-04-27 20:35:33 +0200 (Tue, 27 Apr 2021)
Build-Date:2021-04-27 21:58:39
Revision:17833
Relative:URL: ^/trunk

Identification: JOSM/1.5 (17833 en) Linux Manjaro Linux
Memory Usage: 2107 MB / 3557 MB (845 MB allocated, but free)
Java version: 1.8.0_292-b10, Oracle Corporation, OpenJDK 64-Bit Server VM
Look and Feel: javax.swing.plaf.metal.MetalLookAndFeel
Screen: :0.0 1920×1200 (scaling 1.00×1.00)
Maximum Screen Size: 1920×1200
Best cursor sizes: 16×16→16×16, 32×32→32×32
Environment variable LANG: sv_SE.UTF-8
System property file.encoding: UTF-8
System property sun.jnu.encoding: UTF-8
Locale info: en_SE
Numbers with default locale: 1234567890 -> 1234567890
Desktop environment: KDE
VM arguments: [-Djosm.restart=true, -Dawt.useSystemAAFontSettings=gasp]
Dataset consistency test: No problems found

Plugins:
+ AddrInterpolation (35640)
+ FastDraw (35640)
+ ImportImagePlugin (35567)
+ OpeningHoursEditor (35640)
+ PicLayer (2a9aa7a)
+ apache-commons (35524)
+ apache-http (35589)
+ areaselector (368)
+ austriaaddresshelper (1597341117)
+ buildings_tools (35740)
+ ejml (35458)
+ geotools (35458)
+ imagery_offset_db (35640)
+ jaxb (35543)
+ jna (35662)
+ jogl (1.2.3)
+ jts (35458)
+ kendzi3d (1.0.205)
+ kendzi3d-resources (0.0.2)
+ log4j (35458)
+ measurement (35640)
+ opendata (35640)
+ pt_assistant (2.1.10-80-g7d9bba3)
+ reverter (35732)
+ tageditor (35640)
+ terracer (35640)
+ turnlanes-tagging (288)
+ turnrestrictions (35640)
+ utilsplugin2 (35691)

Tagging presets:
+ https://josm.openstreetmap.de/josmfile?page=Presets/PublicTransportOneClick&zip=1
+ ${HOME}/Dokument/QuickSets.zip
+ https://josm.openstreetmap.de/josmfile?page=Presets/ParkingLanes&zip=1
+ https://github.com/kendzi/Simple3dBuildingsPreset/releases/download/0.9_2018-05-08/s3db-preset.zip

Map paint styles:
- https://josm.openstreetmap.de/josmfile?page=Styles/Fixme&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/LayerChecker&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Coloured_Streets&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Maxspeed&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Surface-DataEntry&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Coloured_buildings&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Enhanced_Lane_and_Road_Attributes&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/ParkingLanes&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/PublicTransport&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/PriorityRoad&zip=1
- ${HOME}/sidewalks-mod.mapcss
- https://josm.openstreetmap.de/josmfile?page=Styles/SimpleBuildingTags&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/SimpleRoofTags&zip=1
- https://raw.githubusercontent.com/yopaseopor/indoormap/master/indoormap-style.mapcss
- https://github.com/GlassOceanos/indoor-JOSM-style/archive/master.zip

Last errors/warnings:
- 00045.680 W: Unable to find supported projection for layer Lantmäteriet ny. Using EPSG:3006.
- 00045.682 W: Unable to find supported projection for layer Lantmäteriet ny. Using EPSG:3006.

Attachments (0)

Change History (14)

comment:1 by simon04, 3 years ago

Cc: Klumbumbus added
Keywords: mapcss added

Cause: fixAdd in the following rule is evaluated when parsing the MapCSS (and not for the individual OSM primitive when building the fix).

*[ele][ele =~ /^-?[0-9]+\.[0-9][0-9][0-9]+$/] {
  throwWarning: tr("{0}", "{0.tag}");
  group: tr("Unnecessary amount of decimal places");
  fixAdd: concat("ele=", round(tag("ele")*100)/100);
}
Last edited 3 years ago by simon04 (previous) (diff)

comment:2 by simon04, 3 years ago

Milestone: 21.05
Owner: changed from team to simon04
Status: newassigned

comment:3 by simon04, 3 years ago

Resolution: fixed
Status: assignedclosed

In 17916/josm:

fix #20957, see #20744 - Fix MapCSS function round

comment:4 by simon04, 3 years ago

Keywords: expression factory regression added

Regression of r17758.

comment:5 by simon04, 3 years ago

Milestone: 21.0521.06

comment:6 by Klumbumbus, 3 years ago

There are 150 objects in the database.
https://taginfo.openstreetmap.org/tags/ele=NaN

comment:7 by simon04, 3 years ago

Milestone: 21.0621.05

r17919 will be released as hotfix.

comment:8 by simon04, 3 years ago

In 17920/josm:

see #20957 - Fix MapCSSParserTest: remove accidentally committed lines

in reply to:  6 ; comment:9 by skyper, 3 years ago

Replying to Klumbumbus:

There are 150 objects in the database.
https://taginfo.openstreetmap.org/tags/ele=NaN

Anybody looking at these objects, already? I guess a semi-automatic correction would be accepted by the community. I can have a look.

comment:10 by mdk, 3 years ago

There are also capacity=NaN (17 times). Maybe there are other keys, but I didn't find out how to search case sesitive in tagInfo.

in reply to:  9 comment:11 by skyper, 3 years ago

Replying to skyper:

Replying to Klumbumbus:

There are 150 objects in the database.
https://taginfo.openstreetmap.org/tags/ele=NaN

Anybody looking at these objects, already? I guess a semi-automatic correction would be accepted by the community. I can have a look.

Fixed in CS 105781206

in reply to:  10 comment:12 by skyper, 3 years ago

Replying to mdk:

There are also capacity=NaN (17 times). Maybe there are other keys, but I didn't find out how to search case sesitive in tagInfo.

I do not find capacity in numeric.mapcss. Is there another place where round() is in use?

comment:13 by mdk, 3 years ago

All capacity=NaN are located in Poland and share the same same tags (only different name):

amenity=bicycle_rental
capacity=NaN
network=MEVO
operator=Nextbike Polska

Could it be that they use local validator rules?
Edit: Most of them are in the first version, so maybe the value is intended or copied.

Last edited 3 years ago by mdk (previous) (diff)

in reply to:  13 comment:14 by skyper, 3 years ago

Replying to mdk:

Could it be that they use local validator rules?

Yes, but than it is not located at this wiki: search

Edit: Most of them are in the first version, so maybe the value is intended or copied.

Please, ask the author(s).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain simon04.
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.