Analyze hotspots

View inAndroidFormsUWPWPFWinUIiOSView on GitHubSample viewer app

Use a geoprocessing service and a set of features to identify statistically significant hot spots and cold spots.

Image of analyze hotspots

Use case

This tool identifies statistically significant spatial clusters of high values (hot spots) and low values (cold spots). For example, a hotspot analysis based on the frequency of 911 calls within a set region.

How to use the sample

Select a date range (between 1998-01-01 and 1998-05-31) from the dialog and tap on Analyze. The results will be shown on the map upon successful completion of the GeoprocessingJob.

How it works

  1. Create a GeoprocessingTask with the URL set to the endpoint of a geoprocessing service.
  2. Create a query string with the date range as an input of GeoprocessingParameters.
  3. Use the GeoprocessingTask to create a GeoprocessingJob with the GeoprocessingParameters instance.
  4. Start the GeoprocessingJob and wait for it to complete and return a GeoprocessingResult.
  5. Get the resulting ArcGISMapImageLayer using GeoprocessingResult.MapImageLayer.
  6. Add the layer to the map's operational layers.

Relevant API

  • GeoprocessingJob
  • GeoprocessingParameters
  • GeoprocessingResult
  • GeoprocessingTask

Tags

analysis, density, geoprocessing, hot spots, hotspots

Sample Code

AnalyzeHotspots.xamlAnalyzeHotspots.xamlAnalyzeHotspots.xaml.cs
Use dark colors for code blocksCopy
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<UserControl x:Class="ArcGISRuntime.WPF.Samples.AnalyzeHotspots.AnalyzeHotspots"
             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}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <!--  Main form  -->
                <TextBlock Grid.Row="0"
                           Text="Select a date range for analysis."
                           TextAlignment="Center"
                           TextWrapping="Wrap" />
                <TextBlock Grid.Row="1"
                           Margin="5,5,5,0"
                           FontWeight="Bold"
                           Text="From" />
                <DatePicker x:Name="FromDate"
                            Grid.Row="2"
                            Margin="5"
                            HorizontalAlignment="Stretch"
                            DisplayDateEnd="5/31/98"
                            DisplayDateStart="1/01/98"
                            SelectedDate="1/01/98" />
                <TextBlock Grid.Row="3"
                           Margin="5,5,5,0"
                           FontWeight="Bold"
                           Text="To" />
                <DatePicker x:Name="ToDate"
                            Grid.Row="4"
                            Margin="5"
                            HorizontalAlignment="Stretch"
                            DisplayDateEnd="5/31/98"
                            DisplayDateStart="1/01/98"
                            SelectedDate="1/31/98" />
                <Button x:Name="AnalyzeButton"
                        Grid.Row="5"
                        Margin="5"
                        Click="OnAnalyzeHotspotsClicked"
                        Content="Run analysis" />
                <!--  Waiting overlay  -->
                <Grid x:Name="BusyOverlay"
                      Grid.Row="0"
                      Grid.RowSpan="6"
                      Margin="-20"
                      Background="#8C000000"
                      Visibility="Collapsed">
                    <Border Padding="15"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Background="#FFC6C4C4">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                            </Grid.RowDefinitions>
                            <ProgressBar x:Name="Progress"
                                         Height="20"
                                         IsIndeterminate="True" />
                            <TextBlock Grid.Row="0"
                                       Height="20"
                                       Margin="5"
                                       HorizontalAlignment="Center"
                                       Text="Executing analysis..." />
                            <Button Grid.Row="1"
                                    HorizontalAlignment="Center"
                                    Click="OnCancelTaskClicked"
                                    Content="Cancel" />
                        </Grid>
                    </Border>
                </Grid>
            </Grid>
        </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.