I have a single band raster image with values of pixel 0 and 1. There's another line vector layer over the same area. I need to find the percentage of line which is overlapped by the pixels of value 1. I am thinking of using clipper in qgis or mask function in R but can't exactly figure out the way. Is there any way of doing this in QGIS or R?
Asked
Active
Viewed 2,589 times
1
-
You could convert the raster to polygons and take the intersection of the two layers. – csk Apr 19 '18 at 17:18
-
@csk.. I tried that but it shows an invalid geometry option while intersection. – Kuljeet Keshav Apr 19 '18 at 18:06
-
Solutions for invalid geometry of vectorized rasters: https://gis.stackexchange.com/questions/226955/qgis-raster-to-polygons-produce-invalid-geometries – csk Apr 19 '18 at 18:14
-
@csk Thanks for help! I used buffer to solve the invalid geometry. – Kuljeet Keshav Apr 19 '18 at 18:29
1 Answers
2
I used the polygonise option to convert the raster to vector. Then I used a subtle buffer as discussed here: Fixing geometry validity errors in QGIS?. Then, I used the intersect option to get the required layer.
Kuljeet Keshav
- 319
- 2
- 14