Analyze hotspots

This sample demonstrates how to execute the GeoprocessingTask asynchronously to calculate a hotspot analysis based on the frequency of 911 calls. It calculates the frequency of these calls within a given study area during a specified constrained time period set between 1/1/1998 and 5/31/1998.

Analyze hotspots result

Instructions

To run the hotspot analysis, select a data range and click on the 'Run analysis' button. Note the larger the date range, the longer it may take for the task to run and send back the results.

Code

<UserControl
    x:Class="ArcGISRuntime.UWP.Samples.AnalyzeHotspots.AnalyzeHotspots"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">

    <Grid>
        <esriUI:MapView x:Name="MyMapView" />
        <Border
                Background="White" BorderBrush="Black" BorderThickness="1"
                HorizontalAlignment="Right" VerticalAlignment="Top"
                Margin="30" Width="375">
            <Grid Margin="20">
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock Text="Select date range for analysis" 
                           Margin="0,0,0,2" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" />
                <StackPanel Grid.Row="1">
                    <TextBlock Text="From" Margin="10,5"></TextBlock>
                    <DatePicker x:Name="FromDate" HorizontalAlignment="Stretch" />
                    <TextBlock Text="To" Margin="10, 5"></TextBlock>
                    <DatePicker x:Name="ToDate" HorizontalAlignment="Stretch" />
                </StackPanel>
                <Button x:Name="analyzeHotspots" Click="OnAnalyzeHotspotsClicked" Content="Run analysis" Margin="10,10" Grid.Row="2"/>
                <Grid x:Name="busyOverlay" Margin="-20" Visibility="Collapsed" Background="#8C000000" Grid.RowSpan="4">
                    <Border HorizontalAlignment="Center" VerticalAlignment="Center" Padding="15" Background="#FFC6C4C4">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>
                            </Grid.RowDefinitions>
                            <ProgressBar IsIndeterminate="True" x:Name="progress" Height="20" />
                            <TextBlock Text="Executing analysis..." HorizontalAlignment="Center" Margin="5" Height="20" />
                            <Button Content="Cancel" Click="OnCancelTaskClicked" HorizontalAlignment="Center" Grid.Row="1"></Button>
                        </Grid>
                    </Border>
                </Grid>
            </Grid>
        </Border>
    </Grid>
</UserControl>


In this topic
  1. Instructions
  2. Code