Buffer list

View inWPFUWPFormsiOSAndroid
View on GitHub

Generate multiple individual buffers or a single unioned buffer around multiple points.

Image of Buffer list

Use case

Creating buffers is a core concept in GIS proximity analysis that allows you to visualize and locate geographic features contained within a set distance of a feature. For example, consider an area where wind turbines are proposed. It has been determined that each turbine should be located at least 2 km away from residential premises due to noise pollution regulations, and a proximity analysis is therefore required. The first step would be to generate 2 km buffer polygons around all proposed turbines. As the buffer polygons may overlap for each turbine, unioning the result would produce a single graphic result with a neater visual output. If any premises are located within 2 km of a turbine, that turbine would be in breach of planning regulations.

How to use the sample

Click/tap on the map to add points. Tap the "Create Buffer(s)" button to draw buffer(s) around the points (the size of the buffer is determined by the value entered by the user). Check the check box if you want the result to union (combine) the buffers. Tap the "Clear" button to start over. The red dashed envelope shows the area where you can expect reasonable results for planar buffer operations with the North Central Texas State Plane spatial reference.

How it works

  1. Use GeometryEngine.Buffer(points, distances, union) to create a Polygon. The parameter points are the points to buffer around, distances are the buffer distances for each point (in meters) and union is a boolean for whether the results should be unioned.
  2. Add the resulting polygons (if not unioned) or single polygon (if unioned) to the map's GraphicsOverlay as a Graphic.

Relevant API

  • Geometry
  • GeometryEngine.Buffer
  • SpatialReference

Additional information

The properties of the underlying projection determine the accuracy of buffer polygons in a given area. Planar buffers work well when analyzing distances around features that are concentrated in a relatively small area in a projected coordinate system. Inaccurate buffers could still be created by buffering points inside the spatial reference's envelope with distances that move it outside the envelope. On the other hand, geodesic buffers consider the curved shape of the Earth's surface and provide more accurate buffer offsets for features that are more dispersed (i.e., cover multiple UTM zones, large regions, or even the whole globe). See the "Buffer" sample for an example of a geodesic buffer.

For more information about using buffer analysis, see the topic How Buffer (Analysis) works in the ArcGIS Pro documentation.

Tags

analysis, buffer, geometry, planar

Sample Code

BufferList.xamlBufferList.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="ArcGISRuntime.Samples.BufferList.BufferList"
    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">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid
            Grid.Row="0"
            Margin="10,0"
            HorizontalOptions="Center">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="40" />
                <RowDefinition Height="40" />
                <RowDefinition Height="40" />
            </Grid.RowDefinitions>
            <Label
                x:Name="BufferInstructionsLabel"
                Grid.Row="0"
                Text="Tap the map to add points. Each point uses the buffer distance entered when it was created. The envelope shows the area where you can expect reasonable results for planar buffers with this map's spatial reference." />
            <StackLayout Grid.Row="1" Orientation="Horizontal">
                <Label Text="Buffer distance (miles):" VerticalOptions="Center" />
                <Entry x:Name="BufferDistanceMilesEntry" Text="10" />
            </StackLayout>
            <StackLayout Grid.Row="2" Orientation="Horizontal">
                <Label Text="Union the buffers:" VerticalOptions="Center" />
                <Switch x:Name="UnionSwitch" IsToggled="True" />
            </StackLayout>
            <StackLayout Grid.Row="3" Orientation="Horizontal">
                <Button
                    x:Name="BufferButton"
                    Clicked="BufferButton_Click"
                    Text="Create buffers"
                    WidthRequest="120" />
                <Button
                    x:Name="ClearButton"
                    Margin="10,0,0,0"
                    Clicked="ClearButton_Click"
                    Text="Clear"
                    WidthRequest="120" />
            </StackLayout>
        </Grid>
        <esriUI:MapView x:Name="MyMapView" Grid.Row="1" />
    </Grid>
</ContentPage>

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