Calculate transformation using output dimensions


Denis Rykov
 

In gdalwarp we have at least two options for managing of output size of a raster:

  • -tr xres yres: set output file resolution (in target georeferenced units)
  • -ts width height: set output file size in pixels and lines
In rasterio we have the following function:
  • rasterio.warp.calculate_default_transform(src_crs, dst_crs, width, height, left=None, bottom=None, right=None, top=None, gcps=None, resolution=None)
If I understood correctly resolution argument has the same meaning as tr in gdalwarp.
But how I can calculate transformation (destination affine first of all) if I know output dimensions (width and height)?

In other words I'm looking for how I can achieve the same result with rasterio as with gdalwarp ts option.

I hope what I have requested is possible.

Join main@rasterio.groups.io to automatically receive all group messages.