Cut geometry

View inAndroidFormsUWPWPFWinUIiOSView 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

Click 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 geometry and polyline to 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.xamlCutGeometry.xamlCutGeometry.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<UserControl x:Name="_this"
             x:Class="ArcGISRuntime.WinUI.Samples.CutGeometry.CutGeometry"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
    <Grid>
        <esriUI:MapView x:Name="MyMapView" />
        <Border Style="{StaticResource BorderStyle}">
            <Button x:Name="CutButton"
                    HorizontalAlignment="Stretch"
                    Click="CutButton_Click"
                    Content="Cut" />
        </Border>
    </Grid>
</UserControl>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.