I am looking for an expression to get_feature with two values from two different fields.
At its core is the question: How can I transform a chain of values which define a point into a valid geometry expression? For example for Point B:
?? geometry ("obj_art" = 'Ansicht' and "ptnr" = 'B') ??
Kasper has given us the answer to the question how a geometry can be defined over several values. You can use the aggregate ( ) expression. On the last position (filter:=), an arbitrarily long chain of values or conditions can be placed. The expression is unfortunately not self explanatory, but there are plenty of examples.
aggregate(layer:=' ', aggregate:=' ', expression:= ,
filter:="prof_nr"= @atlas_pagename and "obj_art"='Ansicht' and "ptnr" ='B' and so on and so on )
My Goal is to plot archaeological profiles via QGIS Atlas. Therefore I want to use Point A and Point B to filter page name. As coverage layer I have a point layer in which point A and B are located. Both points have the same value in field “prof_nr” so that is page name. Both points are defined by two other values from two different fields (Image 1).
My approach is to make_line out of both points, so that I always get only one Atlas feature per archaeological profile on which the map zooms in the middle. Both points can be easily called by CASE WHEN but with the expression I do not succeed in creating a line (Image 1)
CASE WHEN "obj_art" = 'Ansicht' and "ptnr" = 'A' or "obj_art" ='Ansicht' and "ptnr" = 'B' THEN "prof_nr" END
Therefore I select only point A for page name and moved the make_line to the extents of the map (Image2, 3)
x_min(
bounds(
make_line(
start_point(@atlas_geometry),geometry(
get_feature('E_Point', 'ptnr','B')
)
)
)
)
Here I can connect both points with make_line, but with get_feature I can only assign a value from one field but to define the point I need two values from two fields for each point.
Does anyone have a solution?