Mapping Toolbox    
polymerge

Merge line segments with matching endpoints.

Syntax

Description

[lat2,lonc2 = polymerge(lat,lon) combines vector line segments with identical endpoints. polymerge compares the endpoints of all line segments and combines those which match. The line may be input as vectors of latitude and longitude with NaNs delimiting segments. The line may also be input as cell arrays, with each element of a cell array containing a line segment. The resulting line is in the same format as the input.

[lat2,lonc2 = polymerge(lat,lon,tol) combines line segments whose endpoints are separated by less than the circular tolerance. If omitted, tol= 0 is assumed. The tolerance is in the same units as the polygon input.

[lat2,lonc2 = polymerge(lat,lon,tol,outputformat) controls the format of the resulting polygons. If outputformat is 'vector', the result is returned as vectors with NaNs separating the segments. If outputformat is 'cell', the result is returned as cell arrays containing segments in each element. If omitted, 'vector' is assumed.

Example

See Also
polyjoin
Convert polygon segments from cell array to vector format
polysplit
Extract segments of NaN-delimited polygon vectors to cell arrays


  polyjoin polysplit