Main Content

Polygon Buffer Zones

A buffer zone is the area within a specified distance of a map feature. For vector geodata, buffer zones are constructed as polygons. A buffer zone can be defined as the locus of points within a certain distance of the boundary of the feature polygon, either inside or outside the polygon. Buffer zones form equidistant contour lines around objects.

The bufferm function computes and returns vectors that represent a set of points that define a buffer zone. It forms the buffer by placing small circles at the vertices of the polygon and rectangles along each of its line segments, and applying a polygon union set operation to these objects.

Generate Buffer Internal to Polygon

This example shows how to use the bufferm function to generate a buffer zone internal to a land area polygon.

Import Madagascar polygon shape.

madagascar = shaperead('landareas.shp','UseGeoCoords',true, ...
    'Selector', {@(name)strcmpi(name,'Madagascar'),'Name'});

Create a map showing Madagascar.

figure
worldmap('madagascar')
geoshow(madagascar)

Use bufferm to create a buffer zone that extends 0.75 degrees inland from the coast of Madagascar.

madlat = madagascar.Lat;
madlon = madagascar.Lon;
bufwidth = 0.75;
direction = 'in';
[latbuf,lonbuf] = bufferm(madlat,madlon,bufwidth,direction);

Show the buffer zone in green.

geoshow(latbuf,lonbuf,'DisplayType','polygon','FaceColor','green')