28 Feb 2022

QGIS 3: Geometry Generator Expression for Points at Line Intersections

A solution for symbolizing line intersections between the current layer's features and another layer's features ('Tracks Subset=Detail'). The
is used with an
which yields the number if features in the other layer used for the intersection. The
iterates over all features of the other layer and intersects each line with the input layer's current feature. The
is needed to filter out the epmty geometries that could result after the intersection. If you wouldn't do this, the code would break when calling
, which is needed to finally convert the array of geometries into a valid, digestible geometry collection, fed into the geometry generator with checking Point/Multi-POint as geometry type..
with_variable ('my_series', generate_series(1, aggregate(layer:='Tracks Subset=Detail', aggregate:='max', expression:="id")),
		array_foreach(@my_series, if(is_empty_or_null( 
			intersection(geometry(get_feature('Tracks Subset=Detail', 'id', @element)),
			$geometry)), 'x', intersection(geometry(get_feature('Tracks Subset=Detail', 'id', @element)),
		@element != 'x'

No comments :

Post a Comment