I have point (manholes) and line (sewer main) datasets and want attributes from the points at both ends of the line.
If I run the following after I install RefFunctions in field calc on the line
geomintersects('Sewer_MH_Test','RL_of_Lid')
I get the value I need from the start of the line (3.78). How do I get the value at the end (3.75) into a new column? Is there some aggregator to use?
Based on @Taras' answer I have been trying the following but it keeps crashing.
WITH start_data AS (
SELECT l.GID_New AS line_id_start, p.US_IL AS x
FROM points AS p
JOIN lines AS l ON st_intersects(start_point(l.geometry),p.geometry)
),
end_data AS (
SELECT l.GID_New AS line_id_end, p.DS_IL AS y
FROM points AS p
JOIN lines AS l ON st_intersects(end_point(l.geometry),p.geometry)
)
SELECT l.*, start_data.x, end_data.y
FROM lines AS l
JOIN start_data ON l.GID_New = line_id_start
JOIN end_data ON l.GID_New=line_id_end
This shows the output I want...
The test data is only about 20 lines and points - it can be downloaded from https://drive.google.com/file/d/12rUV_pAaevs9vATbIsgc9QJvvziRygGN/view?usp=sharing