View in MAUI WPF WinUI View on GitHub

Cut a geometry along a polyline.

Image of cut geometry

Use case

You might cut a polygon representing a large parcel to subdivide it into smaller parcels.

How to use the sample

Tap the “Cut” button to cut the polygon with the polyline and see the resulting parts (shaded in different colors).

How it works

  1. Pass the polyline to the static extension method GeometryEngine.Cut() to cut the geometry along the polyline.
  2. Loop through the returned list of part geometries. Some of these geometries may be multi-part.

Relevant API

  • GeometryEngine.Cut
  • Polygon
  • Polyline

Tags

cut, geometry, split

Sample Code

CutGeometry.xaml CutGeometry.xaml CutGeometry.xaml.cs
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="ArcGIS.Samples.CutGeometry.CutGeometry"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Maui;assembly=Esri.ArcGISRuntime.Maui">
<Grid>
<esriUI:MapView x:Name="MyMapView" />
<Button x:Name="CutButton"
Margin="10"
Clicked="CutButton_Clicked"
HorizontalOptions="End"
Text="Cut"
VerticalOptions="Start" />
</Grid>
</ContentPage>