Abdul, Maybe run gdal warp twice. First do the reproject and resample. Second, do the cutline on the output from the first.
Martin > On May 10, 2022, at 4:47 PM, Abdul Raheem Siddiqui > <[email protected]> wrote: > > > Hello all, > > I would like to know if anyone in the community is aware of a way to control > GDALWARP order of operations, or is it even possible? > > I need GDAL to reproject a raster to a new CRS and cell size then mask the > raster to a polygon. > > (the new size is smaller than the original, I know it is not a great idea, > but we need to do it for our purposes) > > Here is the command > > gdalwarp -overwrite -t_srs EPSG:26917 -of GTiff -cutline > C:/Users/asiddiqui/Downloads/MASK.gpkg -cl MASK -tr 30.0 30.0 -te > 527130.3170769732 3656970.1048127464 571830.3170769732 3707430.1048127464 -r > near -wo CUTLINE_ALL_TOUCHED=TRUE > C:/Users/asiddiqui/Downloads/Align_Test_data/Precip.tif > C:/Users/asiddiqui/Downloads/Precip2.tif > GDAL is masking the raster first, thus picking cells with larger sizes that > are touching polygon and then reprojecting and making cell size smaller. This > is causing a lot of extra cells to be there when they shouldn't be (Hard to > visualize here because the actual raster cell size is smaller than the size > that appears in the picture because all the small cells have the same value). > > What I want GDAL to do is to reproject the raster to a smaller cell size > first and then mask to get a result like this. > > > > Abdul Raheem Siddiqui > [email protected] > > > > _______________________________________________ > gdal-dev mailing list > [email protected] > https://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________ gdal-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/gdal-dev
