Opened 6 years ago
Last modified 13 months ago
#17533 reopened enhancement
Check waterway flow direction
Reported by: | gaben | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core validator | Version: | latest |
Keywords: | waterway direction | Cc: | Klumbumbus, gaben, taylor.smock, skyper |
Description (last modified by )
What steps will reproduce the problem?
- Recreate the following as on the picture
- Run the validator
What is the expected result?
JOSM should warn about the middle drain because it has drawn in the wrong direction (also see #12646).
What happens instead?
Nothing.
URL:https://josm.openstreetmap.de/svn/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2019-03-26 22:46:08 +0100 (Tue, 26 Mar 2019) Build-Date:2019-03-27 02:30:53 Revision:14936 Relative:URL: ^/trunk Identification: JOSM/1.5 (14936 hu) Windows 10 64-Bit OS Build number: Windows 10 Pro 1809 (17763) Memory Usage: 718 MB / 1820 MB (516 MB allocated, but free) Java version: 1.8.0_201-b09, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM Screen: \Display0 1920x1200 Maximum Screen Size: 1920x1200 VM arguments: [-Djava.security.manager, -Djava.security.policy=file:<java.home>\lib\security\javaws.policy, -DtrustProxy=true, -Djnlpx.home=<java.home>\bin, -Djnlpx.origFilenameArg=%UserProfile%\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\31\583aa85f-6f9da138, -Djnlpx.remove=false, -Djava.util.Arrays.useLegacyMergeSort=true, -Djnlpx.heapsize=NULL,2048m, -Djnlpx.splashport=50584, -Djnlp.application.href=https://josm.openstreetmap.de/download/josm-latest.jnlp, -Djnlpx.jvm=<java.home>\bin\javaw.exe] Dataset consistency test: No problems found Plugins: + OpeningHoursEditor (34867) + apache-commons (34506) + continuosDownload (82) + ejml (34389) + geotools (34513) + jaxb (34678) + jts (34524) + opendata (34911) + reverter (34946) + tag2link (34867) + tageditor (34867) + turnlanes-tagging (280) + utilsplugin2 (34932) + wikipedia (v1.1.1) Map paint styles: - https://josm.openstreetmap.de/josmfile?page=Styles/Maxspeed&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1 Validator rules: + https://josm.openstreetmap.de/josmfile?page=Rules/OsmoseValidations&zip=1 Last errors/warnings: - W: No configuration settings found. Using hardcoded default values for all pools.
Attachments (2)
Change History (46)
by , 6 years ago
Attachment: | flow direction.png added |
---|
comment:1 by , 6 years ago
Description: | modified (diff) |
---|
comment:2 by , 6 years ago
Keywords: | waterway direction added |
---|
comment:5 by , 6 years ago
Cc: | added |
---|---|
Summary: | Check waterway flow direction → [PATCH] Check waterway flow direction |
@Klumbumbus do we have core support to detect first/last node in mapcss without requiring to set custom class? It would simplify the proposed patch.
comment:8 by , 5 years ago
Reporter: | changed from | to
---|
comment:9 by , 5 years ago
Replying to gaben:
I'm the OP.
How can I test the proposed patch?
you can save as a .mapcss file and add it locally in JOSM preferences
comment:10 by , 5 years ago
i just tested on a larger data set and it needs some more work - throwing a lot a false positives
comment:11 by , 5 years ago
refined the check slightly - ready for testing
*[waterway][waterway!=drain] node:connection { set exclude; } way[waterway=drain] >[index!=-1] node:connection { set notlastnode; } way[waterway=drain] node:connection!.notlastnode!.exclude { throwWarning: "result"; } way[waterway=drain] >[index!=1] node:connection { set notfirstnode; } way[waterway=drain] node:connection!.notfirstnode!.exclude { throwWarning: "result2"; }
follow-up: 14 comment:12 by , 5 years ago
OK, some remarks:
- please add explicit child selector ">". The syntax you used works but is only here for compatibility
- the classes should have more specific names, so we can have similar rules
- of course the message warning must be reworded too :)
comment:13 by , 5 years ago
From user perspective the rule working good, I already fixed a fair amount of long waterways with many short wrong direction segments. So it's definitely worth implementing it properly :)
comment:14 by , 5 years ago
Replying to Don-vip:
OK, some remarks:
- please add explicit child selector ">". The syntax you used works but is only here for compatibility
- the classes should have more specific names, so we can have similar rules
- of course the message warning must be reworded too :)
Hi Don-vip, I've added your recommendations. Does this look better?
*[waterway][waterway!=drain] > node:connection { set notDrain; } way[waterway=drain] >[index!=-1] node:connection { set notDrainLastNode; } way[waterway=drain] > node:connection!.notDrainLastNode!.notDrain { throwWarning: tr("incorrect drain flow direction"); } way[waterway=drain] >[index!=1] node:connection { set notDrainFirstNode; } way[waterway=drain] > node:connection!.notDrainFirstNode!.notDrain { throwWarning: tr("incorrect drain flow direction"); }
follow-up: 17 comment:15 by , 5 years ago
I'm unfamiliar with creating a pull request in this repo. Can someone please point me in the right direction? Thank you
comment:16 by , 5 years ago
Milestone: | → 20.01 |
---|
follow-up: 18 comment:17 by , 5 years ago
Replying to dmanzer95:
I'm unfamiliar with creating a pull request in this repo. Can someone please point me in the right direction?
Until we switch to git/gitlab you have to attach a patch to this ticket. See https://josm.openstreetmap.de/wiki/DevelopersGuide/PatchGuide
comment:18 by , 5 years ago
Replying to Don-vip:
Replying to dmanzer95:
I'm unfamiliar with creating a pull request in this repo. Can someone please point me in the right direction?
Until we switch to git/gitlab you have to attach a patch to this ticket. See https://josm.openstreetmap.de/wiki/DevelopersGuide/PatchGuide
Thanks! What's the timeline for this migration?
comment:20 by , 5 years ago
Milestone: | 20.01 → 20.02 |
---|
comment:22 by , 5 years ago
Can someone confirm the fix? Tried applying @dmanzer95's patch now, which doesn't work at all and the integrated either :/ The proposed patch worked before, I don't know what happened. I'm using r15840.
comment:23 by , 5 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Tested in a VM, it's not working.
follow-up: 25 comment:24 by , 5 years ago
Milestone: | 20.02 → 20.03 |
---|
@dmanzer95 can you please check? It doesn't work for me either.
Also, why is the check restricted to waterway=drain? The test would be useful for all flowing waterways.
comment:25 by , 5 years ago
Replying to Don-vip:
@dmanzer95 can you please check? It doesn't work for me either.
Also, why is the check restricted to waterway=drain? The test would be useful for all flowing waterways.
Should be the opposite. Drain
and some canal
might give false positives.
comment:27 by , 5 years ago
Milestone: | 20.03 |
---|---|
Summary: | [PATCH] Check waterway flow direction → Check waterway flow direction |
@anyone interested in the feature: please submit a working patch
comment:28 by , 5 years ago
Hello, all.
I have also tested the proposed patch in the latest version and can confirm that it does not currently work.
My theory of why it worked before, but doesn't now is because it appears that the MapCSS child selector is functioning differently in the latest version of JOSM. If others can confirm, I will open an additional ticket
In previous versions of JOSM, this MapCSS line would select all nodes on a way with the tag waterway=drain
way[waterway=drain] > node
In the latest version, this line does not function the same way, and does not select those nodes.
Did the JOSM MapCSS implementation change? https://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation
comment:32 by , 5 years ago
Other tests like highway node connected to building also don't work.
Work around:
-
src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
969 969 } 970 970 } 971 971 } 972 973 @Override 974 public boolean isPrimitiveUsable(OsmPrimitive p) { 975 return p.isUsable() && (!(p instanceof Way) || (((Way) p).getNodesCount() > 1)); // test only Ways with at least 2 nodes 976 } 972 977 }
follow-up: 34 comment:33 by , 5 years ago
Better solution might be to revert the changes regarding p.isTagged()
comment:34 by , 5 years ago
Replying to GerdP:
Better solution might be to revert the changes regarding
p.isTagged()
Yep, I'm doing that
comment:36 by , 5 years ago
@dmanzer95 can you please check the patch works again, and address comment:24 / comment:25? Thanks!
comment:37 by , 5 years ago
- Currently we draw direction arrows for,
waterway=stream|river|ditch|drain|tidal_channel
, see here - About missing conections (unconnected ends) we warn for
waterway=stream|river|drain
, see here (ditch
was removed with #16334 andtidal_channel
not added as they end more often than the others into the ocean without further connection.)
follow-ups: 39 41 comment:38 by , 5 years ago
I've tested version 15937 and it does not work. Which version should I be testing?
Addressing comments 24 and 25: Testing all waterways is much more complex. I can look into it using MapCSS, but it might be better executed as a java check
comment:39 by , 5 years ago
Replying to dmanzer95:
I've tested version 15937 and it does not work. Which version should I be testing?
r16154+, see comment:35
comment:40 by , 5 years ago
The example in 17533-sample.osm doesn't produce a warning, neither for waterway=drain nor for waterway=river.
Tested with r16406.
My understanding is that the river should produce two warnings, but the drains have no direction.
comment:41 by , 4 years ago
comment:42 by , 13 months ago
iD already has this feature: https://github.com/openstreetmap/iD/issues/6216
comment:43 by , 13 months ago
Cc: | added |
---|
comment:44 by , 13 months ago
Actually, I lost track of the tickets regarding flow directions or looping of waterways.
MapCSS validation check for incorrect drain flow