Analyze hotspots

View inWPFUWPFormsiOSAndroid
View on GitHub

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

Geoprocessing, GeoprocessingJob, GeoprocessingParameters, GeoprocessingResult

Sample Code

AnalyzeHotspots.xamlAnalyzeHotspots.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
<?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"
             x:Class="ArcGISRuntime.Samples.AnalyzeHotspots.AnalyzeHotspots">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Label Text="Start date:"
               Grid.Row="0" Grid.Column="0"
               HorizontalTextAlignment="Start"
               VerticalTextAlignment="Center"/>
        <DatePicker x:Name="StartDate" Date="1/01/98"
                    Grid.Row="0" Grid.Column="1" />
        <Label Text="End date:"
               Grid.Row="1" Grid.Column="0"
               HorizontalTextAlignment="Start"
               VerticalTextAlignment="Center"/>
        <DatePicker x:Name="EndDate" Date="1/31/98"
                    Grid.Row="1" Grid.Column="1" />
        <Button Text="Run Analysis"
                Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"
                Clicked="OnRunAnalysisClicked" />
        <ActivityIndicator x:Name="MyActivityIndicator"
                           Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2"
                           IsVisible="False" />
        <esriUI:MapView x:Name="MyMapView"
                        Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="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.