0

Is it possible to crop a .vrtmosaic to a vector-geometry? I have a .vrt-file which is a mosaic of various sentinel2-scenes. For me it seems to be more efficient to already crop and mask (set everything outside the polygon to NA) before converting to a .tiff-file. I know that I can use something like gdalwarp -cutline... to crop the .tiff. But does this work with a .vrt aswell?

6
  • 1
    Yes it does. GDAL stands for "geospatial data abstraction library" and all inputs are alike for it.
    – user30184
    Commented Feb 18, 2020 at 8:01
  • thanks! Any idea on how to do it? Commented Feb 19, 2020 at 7:44
  • In most simple case with shapefile mask with one polygon in the same CRS than the VRT just gdalwarp -cutline mask.shp input.vrt output.tif.
    – user30184
    Commented Feb 19, 2020 at 7:52
  • thank you very much ! I tried this one. The issue is, that I have a vrt where there are 10 Bands of type Int16 and one, the qa layer, of type byte. The nodata-value for the 10 bands is -1000, for the qa it's 255. When I do the above command I get the vrt cropped. But when I convert it into a tif, it's all black... Commented Feb 19, 2020 at 8:16
  • 2
    Sorry, I have no experience on such data. Probably I would drop the qa layer and play first with the Int16 bands and see later how to handle the qa layer. But 16 bit images often appear black in viewers just because all data are in the low end of the 16 bit range. Check if you viewer is stretching by min/max.
    – user30184
    Commented Feb 19, 2020 at 8:29

0

Your Answer

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

Browse other questions tagged or ask your own question.