2

I am writing an SQL query to calculate the length of lines inside a polygon.

SELECT r.*, st_length(st_intersection(r.geometry,b.geometry)) AS Length_Inside
FROM Gen_Line as r, Buffered as b
WHERE st_intersects(r.geometry,b.geometry)

The line file here is 'Gen_Line' and Buffer file is 'Buffered'. The line file has 7 features and polygon file has 1 feature. I am not sure as to why this is not working.

I am writing is query in Virtual Layer, after adding both the files there. The Layer CRS is same for both files as well as output file and is meters based.

The Virtual Layer attribute table is empty, and the line intersects with the polygon. I am attaching a photo below for reference.

enter image description here

1
  • it works fine now, when i was using the buffer without saving it, there was some glitch idk why Jun 7, 2021 at 7:30

1 Answer 1

1

Seems like everything works well

result

Environment: 3.18.1-Zürich on Windows 10

Not the answer you're looking for? Browse other questions tagged or ask your own question.