Apply scheduled updates to a downloaded preplanned map area.
Use case
With scheduled updates, the author can update the features within the preplanned areas on the service once, and multiple end-users can request these updates to bring their local copies up to date with the most recent state. Importantly, any number of end-users can download the same set of cached updates which means that this workflow is extremely scalable for large operations where you need to minimize load on the server.
This workflow can be used by survey workers operating in remote areas where network connectivity is not available. The workers could download mobile map packages to their individual devices and perform their work normally. Once they regain internet connectivity, the mobile map packages can be updated to show any new features that have been added to the online service.
How to use the sample
Start the app. It will display an offline map, check for available updates, and show update availability and size. Select 'Apply Updates' to apply the updates to the local offline map and show the results.
How it works
- Create an
OfflineMapSyncTask
with your offline map. - If desired, get
OfflineMapUpdatesInfo
from the task to check for update availability or update size. - Get a set of default
OfflineMapSyncParameters
for the task. - Set the parameters to download all available updates.
- Use the parameters to create an
OfflineMapSyncJob
. - Start the job and get the results once it completes successfully.
- Check if the mobile map package needs to be reopened, and do so if necessary.
- Finally, display your offline map to see the changes.
Relevant API
- MobileMapPackage
- OfflineMapSyncJob
- OfflineMapSyncParameters
- OfflineMapSyncResult
- OfflineMapSyncTask
- OfflineMapUpdatesInfo
Offline data
This sample uses a mobile map package, which can be found on ArcGIS Online.
The DataManager
class is used download data from an ArcGIS Online portal item to the local application data folder. Most samples use a call from the sample viewer code to download the data before starting the sample. The data is not re-downloaded if the sample is opened again. This sample uses DataManager
to delete the mobile map package data (if present) and download it again. Applying updates to the map package changes the offline data, so that data must be refreshed every time this sample is opened.
About the data
The data in this sample shows the roads and trails in the Canyonlands National Park, Utah. Data by U.S. National Parks Service. No claim to original U.S. Government works.
Additional information
Note: preplanned areas using the Scheduled Updates workflow are read-only. For preplanned areas that can be edited on the end-user device, see the Download preplanned map area sample. For more information about offline workflows, see Offline maps, scenes, and data in the ArcGIS Developers guide.
Tags
offline, preplanned, pre-planned, synchronize, update
Sample Code
<UserControl
x:Class="ArcGIS.UWP.Samples.ApplyScheduledUpdates.ApplyScheduledUpdates"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esri="using:Esri.ArcGISRuntime"
xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
<Grid>
<esriUI:MapView x:Name="MyMapView" />
<Border Style="{StaticResource BorderStyle}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Button
x:Name="ApplyButton"
Grid.Row="0"
HorizontalAlignment="Stretch"
Click="ApplyButton_Click"
Content="Apply scheduled updates"
IsEnabled="False" />
<TextBlock x:Name="InfoLabel" Grid.Row="1" />
</Grid>
</Border>
</Grid>
</UserControl>