Resample a raster to the grid of another unaligned raster using GDAL/pktools

by GreatEmerald   Last Updated August 14, 2019 18:22 PM

Is there a way to resample a raster to the grid of another raster using Bash utilities (GDAL or pktools), if both of the rasters do not necessarily have their origins aligned (and without an intermediary origin alignment step)?

Here are some example file gdalinfo output. Reference:

Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (-70.000496031746025,15.000496031746032)
Pixel Size = (0.000992063492063,-0.000992063492063)
Image Structure Metadata:
  COMPRESSION=DEFLATE
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( -70.0004960,  15.0004960) ( 70d 0' 1.79"W, 15d 0' 1.79"N)
Lower Left  ( -70.0004960,   5.0004960) ( 70d 0' 1.79"W,  5d 0' 1.79"N)
Upper Right ( -60.0004960,  15.0004960) ( 60d 0' 1.79"W, 15d 0' 1.79"N)
Lower Right ( -60.0004960,   5.0004960) ( 60d 0' 1.79"W,  5d 0' 1.79"N)
Center      ( -65.0004960,  10.0004960) ( 65d 0' 1.79"W, 10d 0' 1.79"N)

Source (to be reprojected):

Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (43.999861111111102,4.000138888888890)
Pixel Size = (0.000277777777778,-0.000277777777778)
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  43.9998611,   4.0001389) ( 43d59'59.50"E,  4d 0' 0.50"N)
Lower Left  (  43.9998611,   2.9998611) ( 43d59'59.50"E,  2d59'59.50"N)
Upper Right (  45.0001389,   4.0001389) ( 45d 0' 0.50"E,  4d 0' 0.50"N)
Lower Right (  45.0001389,   2.9998611) ( 45d 0' 0.50"E,  2d59'59.50"N)
Center      (  44.5000000,   3.5000000) ( 44d30' 0.00"E,  3d30' 0.00"N)

Basically, this is a question related to this question just without using Python or QGIS.

Tags : gdal resampling


Related Questions


What resampling method is used in gdal_merge?

Updated June 22, 2015 22:09 PM

Using max as resampling method with gdal_translate?

Updated October 10, 2018 00:22 AM

resample raster from python without using gdalwrap

Updated March 29, 2017 18:22 PM

Resampling DEM using gdal in python?

Updated September 03, 2017 21:22 PM

gdalwarp resampling method always "nearest"

Updated January 31, 2019 11:22 AM