georesample
Description
Examples
Read raster data into the workspace as an array and a geographic postings reference object. The array is of size 1201-by-1201.
[A,RA] = readgeoraster("n40_w106_3arc_v2.dt1",OutputType="double");
Create the target reference object by making a copy of the original reference object. Specify a new raster size by changing the RasterSize
property of the target reference object.
RB = RA; RB.RasterSize = [701 701];
Resample the raster data. The resampled array is of size 701-by-701.
B = georesample(A,RA,RB);
Read raster data into the workspace as an array and a geographic postings reference object. The raster has latitude limits in the range [40, 41] and longitude limits in the range [–106, –105].
[A,RA] = readgeoraster("n40_w106_3arc_v2.dt1",OutputType="double");
Create the target reference object by making a copy of the original reference object. Specify new latitude and longitude limits by changing the LatitudeLimits
and LongitudeLimits
properties of the target reference object.
RB = RA; RB.LatitudeLimits = [40 40.5]; RB.LongitudeLimits = [-106 -105.5];
Resample the raster data.
B = georesample(A,RA,RB);
Read elevation data from two files into the workspace. The files contain data for the same area of interest.
n40_w106_3arc_v2.dt1
contains medium-resolution data, with posting point samples every 3 arc seconds.w106/n40.dt0
contains coarse-resolution data, with posting point samples every 30 arc seconds.
[A1,R1] = readgeoraster("n40_w106_3arc_v2.dt1",OutputType="double"); [A2,R2] = readgeoraster("w106/n40.dt0",OutputType="double");
Verify that the data sets use the same type of coordinate system.
isequal(R1.CoordinateSystemType,R2.CoordinateSystemType)
ans = logical
1
Verify that the data sets use the same geographic coordinate reference system.
isequal(R1.GeographicCRS,R2.GeographicCRS)
ans = logical
1
Resample the medium-resolution data to match the resolution of the coarse-resolution data.
resampledA1 = georesample(A1,R1,R2);
Note that the resampled array and the coarse-resolution array have the same size.
whos resampledA1 A2
Name Size Bytes Class Attributes A2 121x121 117128 double resampledA1 121x121 117128 double
Read raster data into the workspace as an array and a geographic postings reference object. The array is of size 1201-by-1201.
[A,RA] = readgeoraster("n40_w106_3arc_v2.dt1",OutputType="double");
Create the target reference object by copying the original reference object and changing the raster size.
RB = RA; RB.RasterSize = [1501 1501];
Resample the raster using the cubic interpolation method.
B = georesample(A,RA,RB,"cubic");
Input Arguments
Geographic raster, specified as an M-by-N or M-by-N-by-P numeric or logical array.
Raster reference for A
, specified as a GeographicCellsReference
object or GeographicPostingsReference
object.
The GeographicCRS
properties of RA
and
RB
must be equal, unless one of the
GeographicCRS
properties is empty.
Target raster reference, specified as a GeographicCellsReference
object or GeographicPostingsReference
object. The resampled raster
B
is referenced to RB
.
The GeographicCRS
properties of RA
and
RB
must be equal, unless one of the
GeographicCRS
properties is empty.
Interpolation method, specified as one of these options:
"linear"
— Linear interpolation. The interpolated value at a query point is based on linear interpolation of the values at neighboring points. This method is sometimes called bilinear interpolation."nearest"
— Nearest-neighbor interpolation. The interpolated value at a query point is the value of the nearest point. This method is useful for resampling indexed images."cubic"
— Cubic interpolation. The interpolated value at a query point is based on cubic interpolation of the values at neighboring points. This method is sometimes called bicubic interpolation.
Output Arguments
Resampled geographic raster, returned as a numeric or logical array.
B
is referenced to the target raster reference
RB
. The data type of B
matches the data type
of A
.
Elements of the resampled raster that are outside the area defined by the original
raster depend on the data type of B
:
When
B
uses thesingle
ordouble
data type, the elements areNaN
values.When
B
uses an integer or logical data type, the elements are0
values.
Tips
To resample a raster in planar map coordinates, use the
mapresample
function.To perform antialiasing when shrinking a raster, use the
georesize
function.
Version History
Introduced in R2025a
See Also
Functions
Objects
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)