2

Following on from Remove white background in Raster in QGIS

When I choose the unwanted value - in my case I want to remove black area around the clipped raster - I write 0 as the unwanted value, but I also lose a lot of important detail in the clipped raster. So there is a lot of differences between the original raster to the clipped raster

enter image description here

How can I choose to remove only the black area around the clipped raster?

  • Have you tried gdalwarp -q -cutline clip.shp -crop_to_cutline -dstalpha gis.stackexchange.com/questions/40765/… ? – AndreJ Jul 16 '17 at 6:25
  • i saw this answer-don't understand what to do?? – newGIS Jul 16 '17 at 6:59
  • 1
    if using 0 as NULL value also affects other parts of your raster, you maybe want to assign a more unique value in the clip dialog. try -9999 and use that as your additional NULL value for transparency – ThingumaBob Jul 16 '17 at 12:56
  • i write 9999 in the unwanted value-nothing happend. – newGIS Jul 16 '17 at 13:37
  • use the info cursor and click on the black area. you should see the info window with the cell value of one of the black raster cells. is it 9999? if so, if you right click on your raster layer > properties > transparency, did you use THAT value in 'additional NULL value'? – ThingumaBob Jul 16 '17 at 15:09
1

finally, I found this solution: I put on top the layer with the desirable area i want to crop. then in the clipper function, i mark those two options:

enter image description here

The result will be the exact area without black areas

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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