Apply scheduled updates to preplanned map area

View inQMLC++
View on GitHub
Sample viewer app

Apply scheduled updates to a downloaded preplanned map area.

screenshot

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 Scheduled Updates' to apply the updates to the local offline map and show the results.

How it works

  1. Create an OfflineMapSyncTask with your offline map.
  2. If desired, get OfflineMapUpdatesInfo from the task to check for update availability or update size.
  3. Get a set of default OfflineMapSyncParameters for the task.
  4. Set the parameters to download all available updates.
  5. Use the parameters to create an OfflineMapSyncJob.
  6. Start the job and get the results once it completes successfully.
  7. Check if the mobile map package needs to be reopened, and do so if necessary.
  8. Finally, display your offline map to see the changes.

Relevant API

  • MobileMapPackage
  • OfflineMapSyncJob
  • OfflineMapSyncParameters
  • OfflineMapSyncResult
  • OfflineMapSyncTask
  • OfflineMapUpdatesInfo

Offline data

Read more about how to set up the sample's offline data here.

Link Local Location
Canyonlands MMPK <userhome>/ArcGIS/Runtime/Data/mmpk/canyonlands.zip

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, pre-planned, preplanned, synchronize, update

Sample Code

ApplyScheduledMapUpdates.qmlApplyScheduledMapUpdates.cppApplyScheduledMapUpdates.h
                                                                                   
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
// [WriteFile Name=ApplyScheduledMapUpdates, Category=Maps]
// [Legal]
// Copyright 2019 Esri.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// [Legal]

import QtQuick 2.6
import QtQuick.Controls 2.2
import Esri.Samples 1.0

Item {

    // add a mapView component
    MapView {
        id: view
        anchors.fill: parent
    }

    // Declare the C++ instance which creates the map etc. and supply the view
    ApplyScheduledMapUpdatesSample {
        id: model
        mapView: view

        onUpdateUi: {
            downloadUpdatesButton.enabled = enabled;
            availabilityText.text = text;
            availabilityDetailsText.text = detailedText;
            busyIndicator.visible = false;
        }
    }

    Rectangle {
        anchors.fill: controlColumn
        anchors.margins: -5
        color: "#404040"
    }

    Column {
        id: controlColumn
        anchors {
            left: parent.left
            top: parent.top
            margins: 10
        }
        spacing: 5

        Button {
            id: downloadUpdatesButton
            text: "Apply Scheduled Updates"
            enabled: false

            onClicked: {
                busyIndicator.visible = true;
                model.updateMap();
            }
        }

        Text {
            id: availabilityText
            color: "white"
        }

        Text {
            id: availabilityDetailsText
            color: "white"
        }
    }

    BusyIndicator {
        id: busyIndicator
        anchors.centerIn: parent
    }
}

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