ee.Geometry.Rectangle.cutLines

Converts LineStrings into a MultiLineString by cutting it in two at each distance along the length of the LineString.

UsageReturns
Rectangle.cutLines(distances, maxError, proj)Geometry
ArgumentTypeDetails
this: geometryGeometry

Cuts the lines of this geometry.

distancesList

Distances along each LineString to cut the line into separate pieces, measured in units of the given proj, or meters if proj is unspecified.

maxErrorErrorMargin, default: null

The maximum amount of error tolerated when performing any necessary reprojection.

projProjection, default: null

Projection of the result and distance measurements, or WGS84 if unspecified.

Examples

Code Editor (JavaScript)

// Define a Rectangle object.
var rectangle = ee.Geometry.Rectangle(-122.09, 37.42, -122.08, 37.43);

// Apply the cutLines method to the Rectangle object.
var rectangleCutLines = rectangle.cutLines({'distances': [10, 100], 'maxError': 1});

// Print the result to the console.
print('rectangle.cutLines(...) =', rectangleCutLines);

// Display relevant geometries on the map.
Map.setCenter(-122.085, 37.422, 15);
Map.addLayer(rectangle,
             {'color': 'black'},
             'Geometry [black]: rectangle');
Map.addLayer(rectangleCutLines,
             {'color': 'red'},
             'Result [red]: rectangle.cutLines');