Mapping Toolbox | ![]() ![]() |
Trim patch map data to a specified region
Syntax
Description
[lat,lon] = maptrimp(lat0,lon0,latlim,lonlim) returns adjusted patch map data sets. The patches must be input in NaN
-delimited vectors lat0
and lon0
. For any patch face completely outside the specified limits, the entire patch face is discarded. When parts of a patch are outside the limits, those data points are moved to lie on the limits. These limits are specified by the two-element vectors latlim
and lonlim
, which have the form [south-limit north-limit]
and [west-limit east-limit]
, respectively.
Examples
Make two patches using the scircle1 command, and display them:
[lat0,lon0] = scircle1([0 0]',[-90 90]',[70 70]'); axesm('pcarree','Grid','on',... 'MeridianLabel','on','ParallelLabel','on') h = fillm(lat0,lon0,'green');
Now, trim the patch data to lie between 80°S and 45°N latitude, and 120°W and 0° longitude. The patch data is in two columns coming out of scircle1, so first you must turn it into NaN
-delimited vectors.
lat0 = [lat0; NaN NaN]; lon0 = [lon0; NaN NaN]; [lat,lon] = maptrimp(lat0(:),lon0(:),[45 -80],[-120 0]); clmo(h) fillm(lat,lon,'green')
Notice that the patch face to the east, lying completely outside the allowed area, was removed. The western patch was trimmed to the required area.
See Also
maptriml |
Trim line vector map data to specified region |
maptrims |
Trim surface matrix map data to specified region |
![]() | maptriml | maptrims | ![]() |