1

I have a raster file which shows the land suitability of a country. I have masked this on top of a shape file which is the country itself. I want to only keep parts of the shape file that overlap with the raster file. Some errors that I could possibly run into are the CRS projections of each file.

Could I get some guidance on how to remove unwanted parts of the shape file. (I only want to keep parts of the brown map where there is blue and yellow)

enter image description here

enter image description here

Solution: I solved this by converting raster to polygon using pixel to polygon and then using vector intersection tool to keep areas of brown map that overlap with the blue and yellow pixels.

4
  • Could you identify the unwanted parts in the picture? They are not clear.
    – Padmanabha
    Oct 21, 2022 at 8:27
  • Unwanted parts would be parts of the shape file (brown map) where it does not overlap with the raster file (blue and yellow data points)
    – Hasan
    Oct 21, 2022 at 8:37
  • So in the example you would keep every brown polygon, because all of them have yellow and blue raster cells overlapping?
    – til_b
    Oct 21, 2022 at 9:06
  • Is it possible to remove parts of a brown polygon and only keep areas of the polygon that have raster data directly overlapping it. Essentially I want to find area of the brown polygon that is suitable to use and the blue and yellow data points show me the area that is suitable
    – Hasan
    Oct 21, 2022 at 13:38

1 Answer 1

1

Perhaps you could create a new vector file with polygons for each connected area in your raster. To do this, make a binary raster where each cell that had data in your original raster has value 1 (you can do this with Raster Calculator). Then, go to Raster -> Conversion -> Polygonize and create your vectorized layer.

1
  • For the creation of the binary raster, then vector file which can be used to clip the unwanted parts of the shape file see this answer
    – user2856
    Oct 21, 2022 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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