View inWPFWinUIUWPFormsiOSAndroidView on GitHub
Sample viewer app
Cut a geometry along a polyline.
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
- Pass the geometry and polyline to
GeometryEngine.Cut
to cut the geometry along the polyline.
- Loop through the returned list of part geometries. Some of these geometries may be multi-part.
Relevant API
- GeometryEngine.Cut
- Polygon
- Polyline
cut, geometry, split
Sample Code
CutGeometry.xamlCutGeometry.xaml.csUse dark colors for code blocks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<UserControl x:Class="ArcGISRuntime.WPF.Samples.CutGeometry.CutGeometry"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
<Grid>
<esri:MapView x:Name="MyMapView" />
<Border Style="{StaticResource BorderStyle}">
<StackPanel>
<TextBlock x:Name="CutInstructionsLabel"
Text="Click 'Cut' to cut the polygon with the polyline."
TextWrapping="Wrap" TextAlignment="Center" FontWeight="SemiBold"
Margin="0,0,0,5" />
<Button x:Name="CutButton"
Content="Cut"
Click="CutButton_Click" />
</StackPanel>
</Border>
</Grid>
</UserControl>