Opened 10 days ago
Last modified 7 days ago
#24096 new defect
Child() is not working in match_expression of presets (although the documentation suggests that it should)
Reported by: | goodidea | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | |
Keywords: | preset match_expression child | Cc: |
Description
According to the JOSM documentation for tagging presets (https://josm.openstreetmap.de/wiki/TaggingPresets), any (valid) search expression should be able to be used for match_expression
. At least that's how I understand the text in the documentation:
match_expression="search expression"
additional criteria for matching primitives, specified in JOSM search syntax. (since r17662)
However, child()
does not seem to be supported in a match_expression
(although it works fine in a search expression in JOSM!)
Examples:
- A preset for a node with
match_expression="child highway=*"
(ormatch_expression="child (highway)"
) never matches in JOSM (or has a false result). No matter if the node is a connected with a highway way or not. - A preset for a node with
match_expression="-child highway=*"
(ormatch_expression="-child (highway)"
) on the other hand always matches (or has a true result).
(I tried all possible syntax notations…)
Is this a bug, a missing feature, or just a documentation flaw (something like only a subset of the expressions possible for search expressions can be used in match_expression
)? If the latter is true, the documentation for match_expression
should be made clearer and specify exactly which type of search expression can and cannot be used.
But my main question is: would it be possible to allow child()
? for match_expression
as well? That would be great and very helpful.
In the latest Vespucci version, for example, this is supported for presets and is used in Simon Poole's "beautified-JOSM-preset" (which is suitable for JOSM and Vespucci) for traffic_sign nodes (nodes connected to a highway should have a direction=*
tag with forward|backward
, whereas separate nodes should have a compass direction as a value for direction=*
– for this you need 2 different presets to clearly distinguish this and offer corresponding values for direction, e.g. in a combo).
Currently these presets work very well in Vespucci, but not in JOSM (see also this GitHub issue: https://github.com/simonpoole/beautified-JOSM-preset/issues/477).
Attachments (0)
Change History (2)
comment:1 by , 10 days ago
Component: | External preset → Core |
---|---|
Keywords: | preset match_expression child added |
Type: | enhancement → defect |
comment:2 by , 7 days ago
Yes, I know that it's rarely used in JOSM's defaultpresets.
But as soon as you start creating custom presets for example (e.g. for certain tag combinations), match_expression
becomes very important and useful to avoid multiple matches in JOSM. In my custom presets (which are based on Simon Poole's "beautified-JOSM-preset") I currently use it 138 times ...
And JOSM's default presets also lack a preset for general traffic_sign=*
tags (or traffic_sign:forward=*
/traffic_sign:backward=*
), where a match_expression
with child()
would be particularly useful. In the defaultpresets, there are only 2 presets for traffic_sign=city_limit
and traffic_sign=maxspeed
(a very limited selection), where a distinction would actually be necessary because of the direction tag, too ...
Anyway, it would be nice if match_expression
could be improved.
match_expression
is rarely used in defaultpresets. In fact in almost five years since it was added it is used only in three cases. I guess the feature is not well tested and I would expect that this is a bug. If not the documentation needs to reflect this.