View in MAUI WPF WinUI View on GitHub
import InlineCode from "@esri-dx/starship-doc-components/components/InlineCode.astro";

Clip a geometry with another geometry.

Image of clip geometry

Use case

Create a new set of geometries for analysis (e.g. displaying buffer zones around abandoned coal mine shafts in an area of planned urban development) by clipping intersecting geometries.

How to use the sample

Click the “Clip” button to clip the blue graphic with the red dashed envelopes.

How it works

  1. Use the static extension method
    to generate a clipped
    , passing in an existing
    and an
    as parameters. The existing geometry will be clipped where it intersects an envelope.
  2. Create a new
    from the clipped geometry and add it to a
    on the
    .

Relevant API

  • Envelope
  • Geometry
  • GeometryEngine.Clip
  • Graphic
  • GraphicsOverlay

Additional information

Note: the resulting geometry may be null if the envelope does not intersect the geometry being clipped.

Tags

analysis, clip, geometry

Sample Code

ClipGeometry.xaml ClipGeometry.xaml ClipGeometry.xaml.cs
<UserControl x:Class="ArcGIS.WinUI.Samples.ClipGeometry.ClipGeometry"
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="ClipButton"
HorizontalAlignment="Stretch"
Click="ClipButton_Click"
Content="Clip" />
</Border>
</Grid>
</UserControl>