#16189 closed enhancement (fixed)
[PATCH] Introduce almost square check for buildings.
Reported by: | marxin | Owned by: | team |
---|---|---|---|
Priority: | major | Milestone: | 18.04 |
Component: | Core validator | Version: | latest |
Keywords: | square angle building | Cc: | bjohas |
Description
I consider it very handy to detect almost square buildings for which users are supposed to use Square command.
Attachments (2)
Change History (30)
by , 7 years ago
Attachment: | 0002-Introduce-almost-square-check-for-buildings.patch added |
---|
follow-up: 2 comment:1 by , 7 years ago
by , 7 years ago
Attachment: | 0001-Introduce-almost-square-check-for-buildings.patch added |
---|
Update version
comment:2 by , 7 years ago
Replying to Don-vip:
Thanks for this second patch :)
Some comments:
getNormalizedAngleInDegrees(double angle)
could be a new public (static) method of theGeometry
class. Also you can return the result directly, no need to changeangle
value.- please always add javadoc for public methods. It's hard to guess what is returned by the
getAngles
method- you can add
@since xxx
in new classes and new public methods of existing classes. We replace the xxx by the revision number when applying the patch- it would be great to also add a unit test for this new check
All notes should be included in new version of the patch.
comment:3 by , 7 years ago
Component: | Core → Core validator |
---|
comment:5 by , 7 years ago
Cc: | added |
---|
comment:6 by , 7 years ago
Keywords: | square angle building added |
---|---|
Milestone: | → 18.04 |
follow-up: 9 comment:8 by , 7 years ago
Priority: | normal → major |
---|
Thanks a lot! This is a great check! I have modified the patch a little bit (code style + add an autofix).
comment:9 by , 7 years ago
Replying to Don-vip:
Thanks a lot! This is a great check! I have modified the patch a little bit (code style + add an autofix).
Thanks for review, it was very fast and helpful!
follow-up: 13 comment:10 by , 7 years ago
Thanks for this feature idea - interesting, in principle!
I think there is an issue here: https://www.openstreetmap.org/way/237778620 this object is flagged with a warning. However, auto-fixing this object moves the nodes by less than the JOSM object history window can display as coordinates (7 decimal places) and it displays "< 0.01 m" difference. Such very very very minor non-square buildings should not be flagged (creates more noise than benefit). I would not like to see edits for such square buildings. Would that non-change be saved in the OSM database as anything but a useless changeset (coordinates are only 7 decimal places in the API)?
Using JOSM 13680 de) Linux, Java: 9.0.4+11, Oracle Corporation, OpenJDK 64-Bit Server VM.
Another thought: how do we deal with buildings which are just not exactly square in reality? They will show up as warning forever - until some JOSM validator user comes by and autofixes it.
comment:11 by , 7 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
follow-up: 14 comment:13 by , 7 years ago
Replying to aseerel4c26:
Another thought: how do we deal with buildings which are just not exactly square in reality?
Let's see with real-world examples until we adjust the test default parameters properly.
follow-up: 15 comment:14 by , 7 years ago
Thanks for the first adjustment!
I have experimented a bit with validator.RightAngleBuilding.minimumDelta (after your change it is 0.025) the realworld example https://www.openstreetmap.org/way/122238292 where only https://www.openstreetmap.org/node/1366557884 would be moved by one 7th decimal (which is still < 0.01 m difference). At least a setting value of 0.15 prevents this building from being flagged, if I have tested correctly.
Still for other buildings this produces many warnings where the nodes would only be shifted by one digit in the 7th decimal. Could we suppress all warnings where the autofix would move nodes by less than 0.0000002? I think this value is reasonable to require since 0.0000001 may be just a slightly different rounding.
I guess that a validator.RightAngleBuilding.minimumDelta value of rather close to 1 instead of close to 0 might be fine for productive use, yes, that needs testing.
comment:15 by , 7 years ago
Replying to aseerel4c26:
I have experimented a bit with validator.RightAngleBuilding.minimumDelta (after your change it is 0.025) the realworld example https://www.openstreetmap.org/way/122238292 where only https://www.openstreetmap.org/node/1366557884 would be moved by one 7th decimal (which is still < 0.01 m difference). At least a setting value of 0.15 prevents this building from being flagged, if I have tested correctly.
Thanks for testing! :)
Could we suppress all warnings where the autofix would move nodes by less than 0.0000002?
No so easy. It would require to simulate the squaring operation. It would have a severe performance impact. I prefer tuning the default values a little bit until we're happy with them :)
follow-up: 19 comment:17 by , 7 years ago
The corner at osmwww:node/2100444620 of osmwww:way/254067656 is reported by the validator as nearly 90° which is fine. However hitting Q or the fix button "destroys" the shape of the building as there is a double 135° corner around osmwww:node/2598976579
So I fear a bit users using the fix button without carefully checking what will or did happen with the whole building (and possible even attached buildings with sharing nodes too).
follow-up: 21 comment:19 by , 7 years ago
Replying to Klumbumbus:
hitting Q or the fix button "destroys" the shape of the building as there is a double 135° corner
Ah, good catch. The autofix can only be applied (for now) when all angles are almost right angles.
comment:20 by , 7 years ago
Replying to Don-vip:
In 13688/josm:
I think 0.1 is still a bit low. osmwww:way/574083092 is reported, however Q and ctrl+H gives no change in the coordinates of the four nodes and a distance <0.01m
The change at Q is visible in JOSM only at zoomlevel 24 and higher (osm carto ends at z19!) (standard dpi screen)
comment:21 by , 7 years ago
Replying to Don-vip:
Replying to Klumbumbus:
hitting Q or the fix button "destroys" the shape of the building as there is a double 135° corner
Ah, good catch. The autofix can only be applied (for now) when all angles are almost right angles.
Not sure if I understand you right, but I can hit the fix button at this building.
comment:23 by , 7 years ago
Sorry I was not clear. I meant that was what JOSM should do, not what it was doing. Now it's better :)
comment:24 by , 7 years ago
For the cases
https://www.openstreetmap.org/way/238067628 true positive
https://www.openstreetmap.org/way/250085807 false positive
https://www.openstreetmap.org/way/250085814 false positive
at least 0.1375 seems to be a good minimum. The current 0.1 is far too small, in my opinion - compare my #comment:14 . I think too many false positives make this validator rule far less useful - and will create may useless history entries in object histories (I guess the API will still save such a change - even if coordinates did not change).
comment:25 by , 7 years ago
180° angles would be OK too for autofixable buildings, e.g. osmwww:way/200056426
comment:28 by , 7 years ago
maxAngleDelta = Config.getPref().getDouble("validator.RightAngleBuilding.maximumDelta", 10.0); minAngleDelta = Config.getPref().getDouble("validator.RightAngleBuilding.minimumDelta", 1.0);
That means all angles within these two ranges 80°-89° and 91°-100° are reported, right?
Thanks for this second patch :)
Some comments:
getNormalizedAngleInDegrees(double angle)
could be a new public (static) method of theGeometry
class. Also you can return the result directly, no need to changeangle
value.getAngles
method@since xxx
in new classes and new public methods of existing classes. We replace the xxx by the revision number when applying the patch