#10471 closed enhancement (fixed)
AND operator in MapCSS
Reported by: | naoliv | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 14.09 |
Component: | Core validator | Version: | |
Keywords: | mapcss | Cc: | lists@…, simon04 |
Description
Could we have some kind of AND operator in MapCSS?
We are trying to implement a test for ford=yes
that is not tagged on a highway + waterway junction.
We have tried way[highway] > node[ford=yes] and way[waterway] > node[ford=yes]
and a more complicated solution like
node[ford?] { set: .ford_not_on_waterway; set: .ford_not_on_highway; } way[waterway] > node[ford?] { unset: .ford_not_on_waterway; } way[highway] > node[ford?] { unset: .ford_not_on_highway; } node.ford_not_on_waterway, node.ford_not_on_highway { throwWarning: tr("ford should be on the node where highway and waterway intersect"); }
but without success.
Is there any way to implement an AND?
JOSM:
Repository Root: http://josm.openstreetmap.de/svn Build-Date: 2014-09-02 01:36:00 Last Changed Author: Don-vip Revision: 7485 Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b URL: http://josm.openstreetmap.de/svn/trunk Last Changed Date: 2014-09-02 02:57:38 +0200 (Tue, 02 Sep 2014) Last Changed Rev: 7485
Attachments (0)
Change History (13)
comment:1 by , 10 years ago
Cc: | added |
---|
comment:2 by , 10 years ago
comment:3 by , 10 years ago
With your code it gives:
ERROR: Cannot add MapCss rule: Cannot add instruction ford_not_on_waterway: null! ERROR: Cannot add MapCss rule: Cannot add instruction ford_not_on_highway: null!
comment:5 by , 10 years ago
How about this?
way[waterway] > node[ford?] { set ford_on_waterway; } way[highway] > node[ford?] { set ford_on_highway; } node[ford?]!.ford_on_waterway, node[ford?]!.ford_on_highway { throwWarning: tr("ford should be on the node where highway and waterway intersect"); }
comment:6 by , 10 years ago
Now it's good!
And since we are here, is it interesting to incorporate this test in JOSM?
This test validates http://wiki.openstreetmap.org/wiki/Ford#Used_on_a_node
comment:8 by , 10 years ago
Milestone: | → 14.09 |
---|
follow-up: 11 comment:9 by , 10 years ago
Does this cover cases where the ford isn't on the waterway way (in the ~middle of the river), but on some partial segment of the surrounding water area (either marked waterway=riverbank or water=*) ?
Also, what about ford=yes on a way instead of node?
It looks like this would show a warning that is incorrect.
But I like the idea of the test.
comment:10 by , 10 years ago
Please try lastest version and report anything that is not working as expected.
comment:11 by , 10 years ago
Replying to anonymous:
Does this cover cases where the ford isn't on the waterway way (in the ~middle of the river), but on some partial segment of the surrounding water area (either marked waterway=riverbank or water=*) ?
Also, what about ford=yes on a way instead of node?
Thought new tagging is using ways instead of nodes like tunnel=*
and bridge=*
. Also need a test for ways and have to consider it on all both test as tagged twice (node + way) is an error.
It looks like this would show a warning that is incorrect.
But I like the idea of the test.
+1
comment:12 by , 10 years ago
I had this in mind: https://www.openstreetmap.org/way/199709633 . I get no warning there, which is correct, but only because the test works only on nodes? So if the test gets extended to ways there should still be no warning because the ford way is over a water area.
comment:13 by , 10 years ago
Yes, it works only on nodes at the moment. Please provide a patch if you want it extended. (Or clearly describe what the check should validate at least.)
There is no colon after
set
and there is nounset
command. Try this:(Look for errors on the console or make a mapstyle for for testing first and read the errors in the style dialog.)