A brief overview of what I want to achieve: Create a map showing all cross-country ski trails in a specific region with some customizations/styling on them.
The data come from OpenStreetMap exclusively. Ski trails can be either relations or ways.
I imported the ways and relations from OpenStreetMap using QuickOSM plugin in QGIS 3 with the following Overpass query:
<osm-script output="xml" timeout="25"> <union> <query type="way"> <has-kv k="piste:type" v="nordic"/> </query> <query type="relation"> <has-kv k="piste:type" v="nordic"/> </query> </union> <union> <item/> <recurse type="down"/> </union> <print mode="body"/> </osm-script>
Now I have 2 layers in QGIS, one for lines (OSM ways) and one for multiline strings (OSM relations).
What I want to do is to add a label on ways (showing the value of the attribute
piste:name or, if it doesn't exist,
name) only if those ways are not part of a relation from the second layer. This is to avoid duplicating the label since these relations already have their name displayed with another labeling rule.
I tried to write rules using geometry functions like
contains() but it seems that I can't reference an object from another layer.
Is there a way to achieve what I want to do in QGIS?