Cut geometry

View inWPFUWPFormsiOSAndroid
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 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.xaml.cs
                          
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             xmlns:local="clr-namespace:ArcGISRuntime.Samples.CutGeometry"
             x:Class="ArcGISRuntime.Samples.CutGeometry.CutGeometry">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Label x:Name="CutInstructionsLabel"
               Grid.Row="0"
               FontSize="Small"
               Text="Click the 'Cut' button to cut the polygon with the polyline and see the resulting parts.">
        </Label>
        <Button x:Name="CutButton"
                Grid.Row="1"
                Text="Cut"
                Clicked="CutButton_Clicked"/>
        <esriUI:MapView x:Name="MyMapView"
                        Grid.Row="2"/>
    </Grid>
</ContentPage>

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