1

In a project using gdal I need to crop a geotiff file with a bounding box in pixel or coordinates epsg:4326. The cropping of large images works fine.

The next step is to manage cases where the image is smaller than the bounding box. The idea here is to avoid getting blank data.

When I crop my geotiff using the gdal_translate tools with -srcwin or -projwin an error occurs when the size of the bounding box is bigger than the geotiff size.

When I crop my geotiff using the gdalwarp tools with -te xmin ymin xmax ymax, my result get the size of the bounding box even if this one is bigger.

What could be the "average" of those two behaviours? Just to fit my result to the interception of the bbox and the geotiff file?

My process makes part of a .NET Project so I could do it into my code using .NET but is there a way or an option in gdal to do it?

I found documentation about the ogr2ogr command -clipsrc but it doesn't manage geotiff file.

Your Answer

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

Browse other questions tagged or ask your own question.