I want to run an aggregate expression in field calculator based on the mid point of a line.
The following uses a buffer of the line but I need it to be on midpoint -how do I do this?
aggregate(layer:='Roads_DVR_July2019', aggregate:='max', expression:="Road_Name"+'\\'+"Photo_Name",filter:= intersects(buffer($geometry,5,4), geometry(@parent)))
There are some options in this post but I am hoping that there is a way to do this without creating a new file with the mid points. For the start/end we have xat(0) (start point), xat(-1) (end point). Is there something for mid point?
UPDATE 1
If I use the following I get no results or error.
aggregate(layer:='Roads_DVR_July2019', aggregate:='max', expression:="Road_Name"+'\\'+"Photo_Name",filter:= intersects(buffer(line_interpolate_point($geometry, $length/2),5,4), geometry(@parent)))
Zoomed into the center we see there is at least one point of the point dataset that is within 5m of the midpoint of the line.
I have tried with 5,50 and 500m buffer but get no results so there must be something wrong with the filter. Is the point it buffers the centroid mid point rather than the mid point on the line that is
ogr2ogr OUTPUT.gpkg "Roads.tab" -dialect sqlite -sql "SELECT ST_Line_Interpolate_Point(geometry, 0.5) AS geometry,* FROM \"Roads\"" -f "GPKG"
