Resize geographic raster
returns the raster
RB] = georesize(
B that is
scale times the size
of the raster
RA is a geographic raster
reference object that specifies the location and extent of data in
georesize returns the raster reference object
that is associated with the returned raster
B. By default,
georesize uses cubic interpolation.
georesize preserves the limits of the raster. If the scale specified
divides evenly into the numbers of cells in each dimension, or the number of samples in each
dimension minus 1, the limits of the output are the same as the input. Otherwise,
georesize adjusts the output limits by a fraction of the cell extents
or sample spacing values.
Import a sample geographic raster and geographic cells reference object.
[Z,R] = readgeoraster('raster_sample2.tif');
Resize the raster using
georesize. Double the length and width of the raster by specifying the scale as 2. Use nearest neighbor interpolation by specifying the interpolation method as
[Z2,R2] = georesize(Z,R,2,'nearest');
You can also resize the input raster by specifying different scales for the north-south and east-west directions.
[Z3,R3] = georesize(Z,R,3,2,'nearest'); R3.RasterSize
ans = 1×2 6 4
Verify the raster has been resized by comparing the size of the original raster with the size of the updated rasters.
ans = 1×2 2 2
ans = 1×2 4 4
ans = 1×2 6 4
If the rasters are small, you can compare them directly.
Z = 2×2 1 2 3 4
Z2 = 4×4 1 1 2 2 1 1 2 2 3 3 4 4 3 3 4 4
Z3 = 6×4 1 1 2 2 1 1 2 2 1 1 2 2 3 3 4 4 3 3 4 4 3 3 4 4
Load a raster data set showing land elevations and bathymetry for the region around the Korean peninsula, at a resolution of 12 cells per degree. The data includes a raster image,
korea5c, and an associated geographic raster reference object,
View the raster data set, using
geoshow, specifying the associated raster reference object.
Resize the raster to be a quarter of its original size.
[resizedKorea,resizedKoreaR] = georesize(korea5c,korea5cR,0.25);
View the resized raster. Note that
geoshow preserves the original limits of the map in the display so that, at first glance, the resized raster appears to be the same size as the original. A closer look reveals that the size of pixels in the resized raster are larger than the pixels in the original.
A— Raster to be resized
Raster to be resized, specified as a numeric or logical array. If
A has more than two dimensions, such as with a color raster in
georesize only resizes the first two dimensions.
RA— Information about location and extent of raster
latscale— Amount of resizing in north-south direction
lonscale— Amount of resizing in east-west direction
method— Interpolation method
Interpolation method, specified as one of the following values:
B— Resized raster
Resized raster, returned as a numeric or logical array.
RB— Information about location and extent of raster
Information about location and extent of the raster, returned as a geographic raster reference object.
georesize with raster data in latitude and longitude
coordinates. To work with projected raster data, in x- and