maptrimp - Trim polygons to latitude-longitude quadrangle

Syntax

[latTrimmed,lonTrimmed] = maptrimp(lat,lon,latlim,lonlim)

[latTrimmed,lonTrimmed] = maptrimp(lat,lon,latlim,lonlim) trims the polygons in lat and lon to the quadrangle specified by latlim and lonlim. latlim and lonlim are two-element vectors, defining the latitude and longitude limits respectively. lat and lon must be vectors that represent valid polygons.

Remarks

maptrimp conditions the longitude limits such that:

Examples

Make two polygons using the scircle1 function, and display them:

[latTrimmed,lonTrimmed] = scircle1([0 0]',[-90 90]',[70 70]');
axesm('pcarree','Grid','on',...
      'MeridianLabel','on','ParallelLabel','on')
h = fillm(latTrimmed,lonTrimmed,'green');

Now trim the data to lie between 80ºS and 45ºN latitude, and 120ºW and 0º longitude. The coordinates are in two-column arrays coming out of scircle1, which you must first turn into NaN-delimited vectors:

latTrimmed = [latTrimmed; NaN NaN];
lonTrimmed = [lonTrimmed; NaN NaN];
[lat,lon] = maptrimp(latTrimmed(:),lonTrimmed(:),... 
            [-80 45],[-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, maptrims

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS