Resize projected raster
returns a raster
RB] = mapresize(
B that is
scale times the size of
RA is a raster reference object that
specifies the location and extent of data in
mapresize returns the raster reference object
that is associated with the returned raster
B. By default,
mapresize uses cubic interpolation.
specifies whether to perform antialiasing when shrinking a raster. When
RB] = mapresize(___,'Antialiasing',TF)
mapresize performs antialiasing. The default
value depends on the type of interpolation specified. For nearest-neighbor interpolation,
the default value is
false. For all other interpolation methods, the
Resize Projected Raster
Import a sample projected raster and map cells reference object.
[Z,R] = readgeoraster('map_sample.tif');
Resize the raster using
mapresize. 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] = mapresize(Z,R,2,'nearest');
Verify the raster has been resized by comparing the size of the original raster with the size of the updated raster.
ans = 1×2 2 2
ans = 1×2 4 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
Resize Projected Raster Data Set
Read a projected raster data set and map cells reference object into the workspace.
[boston,R] = readgeoraster('boston.tif');
Display the raster with
Resize the projected raster data set. For this example, reduce the raster to one sixteenth of the original size.
[resizedBoston,resizedR] = mapresize(boston,R,1/16);
Display the resized raster. Note that
mapshow 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 — Projected map raster
numeric or logical array
Projected map raster, specified as a numeric or logical array. If
A has more than two dimensions,
resizes the first two dimensions.
RA — Raster reference for A
MapCellsReference object |
Raster reference for
A, specified as a
MapCellsReference object or
method — Interpolation method
cubic (default) |
Interpolation method, specified as one of the following values.
B — Resized raster
numeric or logical array
Resized raster, returned as a numeric or logical array.
RB — Information about location and extent of raster
map raster reference object
Information about location and extent of raster, returned as a map raster reference object.
mapresizewith raster data in x- and y-coordinates. To work with geographic raster data in latitude and longitude coordinates, use
Introduced in R2019a