bufferm - Buffer zones for latitude-longitude polygons

Syntax

[latb,lonb] = bufferm(lat,lon,dist,direction)
[latb,lonb] = bufferm(lat,lon,dist,direction,npts)
[latb,lonb] = bufferm(lat,lon,dist,direction,npts,outputformat)

Description

[latb,lonb] = bufferm(lat,lon,dist,direction) computes the buffer zone around a polygon. A buffer zone for a closed polygon is defined as the locus of points that are a certain distance in or out of the polygon. A buffer zone for an open polygon is the locus of points a certain distance out from the polygon. The polygon is specified as vectors of latitude and longitude in units of degrees. The distance is a scalar specified in degrees of arc along the surface. Valid direction strings are 'in' and 'out'. The result is returned as NaN-clipped vectors in units of degrees.

[latb,lonb] = bufferm(lat,lon,dist,direction,npts) controls the number of points used to construct circles about the vertices of the polygon. A larger number of points produces smoother buffers, but requires more time. If omitted, 13 points per circle are used.

[latb,lonb] = bufferm(lat,lon,dist,direction,npts,outputformat) controls the format of the returned buffer zones. outputformat 'vector' returns NaN-clipped vectors. outputformat 'cutvector' returns NaN-clipped vectors with cuts connecting holes to the exterior of the polygon. outputformat 'cell' returns cell arrays in which each element of the cell array is a separate polygon. Each polygon can consist of an outer contour followed by holes separated with NaNs.

Examples

Load the coordinates for the conterminous U.S. and its great lakes. Construct a 1-degree buffer zone around the great lakes, another buffer one-third of a degree wide inside the great lakes, and display the resulting buffers over the lake and state boundaries using geoshow:

load conus
tol = 0.1; % Tolerance for simplifying polygon outlines
[reducedlat, reducedlon] = reducem(gtlakelat, gtlakelon, tol);
dist = 1;  % Buffer distance in degrees
[latb, lonb] = bufferm(reducedlat, reducedlon, dist, 'out');
[lati, loni] = bufferm(reducedlat, reducedlon, 0.3*dist, 'in');
usamap({'MN','NY'})
geoshow(latb, lonb, 'DisplayType', 'polygon',...
       'FaceColor', 'yellow')
geoshow(gtlakelat, gtlakelon,...
       'DisplayType', 'polygon', 'FaceColor', 'blue')
geoshow(lati, loni, 'DisplayType', 'polygon',...
       'FaceColor', 'magenta')
geoshow(uslat, uslon)
geoshow(statelat, statelon)

See Also

polybool

  


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