geocrop
Description
[
crops the raster specified by B
,RB
] = geocrop(A
,RA
,latlim
,lonlim
)A
and raster reference
RA
and returns the cropped raster B
and raster
reference RB
. The returned raster is cropped to geographic limits in
degrees close to those specified by latlim
and
lonlim
.
To clip vector data represented by a point, line, or polygon shape in geographic
coordinates, use the geoclip
function
instead.
Examples
Crop Geographic Raster
Crop a geographic raster and display the cropped raster on a map.
First, load elevation raster data and a geographic cells reference object for the Korean peninsula. Then, crop the raster to the limits specified by latlim
and lonlim
.
load korea5c
latlim = [34.25 38.72];
lonlim = [125.85 129.92];
[B,RB] = geocrop(korea5c,korea5cR,latlim,lonlim);
Display the cropped raster as a surface on a map. Apply a colormap appropriate for elevation data using the demcmap
function.
worldmap(latlim,lonlim) geoshow(B,RB,'DisplayType','surface') demcmap(B)
Shift Longitude Limits
Shift the longitude limits of a raster with limits that span 360 degrees using the geocrop
function. Then, display the shifted data as a surface on a map.
First, load elevation raster data for the world and a geographic cells reference object. Then, shift the longitude limits of the raster from [0, 360] to [-180, 180].
load topo60c
latlim = topo60cR.LatitudeLimits;
[B,RB] = geocrop(topo60c,topo60cR,latlim,[-180 180]);
Compare the rasters by querying their LongitudeLimits
properties.
topo60cR.LongitudeLimits
ans = 1×2
0 360
RB.LongitudeLimits
ans = 1×2
-180 180
Display the shifted data as a surface on a map. Move the meridian labels to the bottom of the map using the mlabel
function. Specify meridian labels to display using the MLabelLocation
property. Then, apply a colormap appropriate for topographic data using the demcmap
function. Note that the shifted longitude limits appear at the edges of the map.
worldmap(RB.LatitudeLimits,RB.LongitudeLimits) geoshow(B,RB,'DisplayType','surface') mlabel('south') setm(gca,'MLabelLocation',-180:90:180) demcmap(B)
Input Arguments
A
— Geographic raster
array
Geographic raster, specified as an M-by-N or M-by-N-by-P numeric or logical array.
RA
— Raster reference
GeographicCellsReference
object | GeographicPostingsReference
object
Raster reference for A
, specified as a GeographicCellsReference
object or GeographicPostingsReference
object.
latlim
— Latitude limits
two-element vector
Latitude limits, specified as a two-element numeric vector of the form
[slat nlat]
, where slat
is the southernmost
limit in degrees and nlat
is the northernmost limit in
degrees.
lonlim
— Longitude limits
two-element vector
Longitude limits, specified as a two-element numeric vector of the form
[wlon elon]
, where wlon
is the westernmost limit
in degrees and elon
is the easternmost limit in degrees.
Output Arguments
RB
— Raster reference
GeographicCellsReference
object | GeographicPostingsReference
object
Raster reference for B
, returned as a GeographicCellsReference
object or GeographicPostingsReference
object. The object type of
RB
matches the object type of RA
.
The exact latitude and longitude limits of RB
do not match the
limits specified by latlim
and lonlim
, unless
they coincide with a cell boundary or posting location. Otherwise, the limits of
RB
are slightly larger than latlim
and
lonlim
.
If the limits specified by latlim
and
lonlim
do not intersect the raster specified by
A
and RA
, then RB
is
empty.
Version History
Introduced in R2020a
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)