Edit data and sync it back - what is the best way?

2063
10
11-13-2018 10:08 PM
ModyBuchbinder
Esri Regular Contributor

We would like to create a offline RunTime application that gets data from our main database, edit it (add, update, delete) and sync it back to the database when it is on-line again.

Our office is not connected to the web and we mainly works with Pro (but have portal too).

A few questions:

1) Can we use MMPK at all or they just read only.

2) Can we create .geodatabase files using pro and edit them in RunTime - how do we sync them back.

3) Do we have to use the portal?

What are the best practices in such a case.

Thanks

10 Replies
AnttiKajanus3
New Contributor III

At the moment ArcGIS Pro doesn't have support for Check-Out / Check-In workflow that would allow you to create editable geodatabases/mobile map packages so the only option that you have is to use Feature Service based approach with Portal (or Online in general but since you don't have access to the web that's not an option). 

To answer your questions directly: 

1) Can we use MMPK at all or they just read only.

MMPKs created using ArcGIS Pro or Python tools are read-only. 

2) Can we create .geodatabase files using pro and edit them in RunTime - how do we sync them back.

You cannot create editable geodatabases that you can use with ArcGIS Runtime using Pro but you could use GeoPackages instead. There isn't way to synchronise the changes to the central geodatabase though so the answer lies in the question 3.

3) Do we have to use the portal?

Shortly, yes. Currently, you need to use Feature Services that with offline/sync capabilities enabled. Also you could have a look to the option taking the whole map offline instead of only taking the data offline. For this, you should make the set of FeatureServices from your data, then create a webmap to the portal that uses them. Then you can take the map directly offline. This workflow reduces quite a bit code on the client and allows better maintainability. There are quite a bit other things why using this approach is good so have a look into it. You can read more about it from Create an offline map—ArcGIS Runtime SDK for .NET | ArcGIS for Developers  

0 Kudos
JoeHershman
MVP Regular Contributor

3)

You don't need to use Portal you can just use ArcGIS Server and generate the replicas from the feature services.  You do lose security with this approach, but it is possible.  I agree with Antti Kajanus‌ if you can do a workflow that allows you to use the offline map approach it does simplify things

Thanks,
-Joe
0 Kudos
ModyBuchbinder
Esri Regular Contributor

Hi Joe/Antti

Thanks for the answers. After reading the docs I have a few more questions...

The docs say Pro can create mmpk for mobile from feature layer. Does that mean you cannot create mmpk for mobile from local layers (shape files or layers in enterprise geodatabase)?

How do I create editable mmpk from feature service directly without portal? All the examples used webmap and Python API.

Thanks

0 Kudos
JoeHershman
MVP Regular Contributor

As Antti mentioned in his response.  MMPK created from Pro are not-editable.  The only way to create anything for offline use is to create a feature service first and use that service for creating the offline data

Thanks,
-Joe
0 Kudos
AnttiKajanus3
New Contributor III

You could look it this way:

1) Use webmap to define your map with layers, symbols, etc...

Use Portal and take the whole map offline using the new functionality. This has many good things such as better maintainability and faster to implement. This is of course assuming that the functionality that you need is supported by this workflow.

2) Use Feature Services hosted in ArcGIS Server as Joe mentioned and generate offline data from them

This is more work for in the client but you can control offline functionality in more detail. You can find more information from Create an offline layer—ArcGIS Runtime SDK for .NET | ArcGIS for Developer

I would recommend prototyping with the option 1 and seeing if that works for you, if it doesn't then start looking to option 2. 

ManuSharma1
New Contributor III

Add to Antti,,

You can also use AGOL. where user can Add data in ArcGIS desktop and do edit and synchronise back to AGOL.

do care about schema and domain default values.

0 Kudos
ModyBuchbinder
Esri Regular Contributor

I would like to renew this discussion to see the changes in 100.6 and 10.7.1 or 10.8

The updated line is Take a layer offline—ArcGIS Runtime SDK for .NET | ArcGIS for Developers 

My understanding is that you have 2 options:

1) Take offline a map - you need to write a small program in Runtime that does this and create a MMPK we can sync back.

2) Take a layer offline - this layer MUST be hosted (we would like our data to stay in the database). This is not MMPK and also need a program in Runtime to create and sync.

Any comments?

Thanks

0 Kudos
JoeHershman
MVP Regular Contributor
  1. Not exactly.  When you take a map offline it does not produce a MMPK file.  The files are contained in a folder on the device.  I believe these are basically the same files contained in an MMPK package, just not packaged.
    1. There are two options to take a map offline.
      1. Generate and download the package on-demand.  This means the user requests the package from the server and all the files are created then downloaded.  These packages can take a while to generate (5-10 minutes, or so depending on size of area and amount of data) which can be inconvenient.
      2. Generate pre-packaged offline packages in portal or agol and then have client download these.  This is far faster, but the number of pre-packaged maps is very limitted (I believe 16 per web map
  2. This is incorrect.  A feature layer does not need to be hosted to be taken offline.  It just needs to be configured correctly.  Both versioned and archive enabled, non-versioned data can be taken offline.  The service needs to be setup to allow Sync when it is published

The simplest way to generate replicas is with Runtime.  Each of the above is slightly different, but follow the same pattern and are quite straight forward.  There are samples of how to do each in documentation

For completeness:  The Runtime API is not required to generate offline data.  The Runtime API simplifies things greatly, but the Runtime API just wraps a bunch of ArcGIS Server Rest API calls.  One could generate replicas using the ArcGIS Server Rest API directly, including doing this from the web interface provided by esri.  In the same manner one could sync data using ArcGIS Server Rest API directly.

Thanks,
-Joe
0 Kudos
LukeSmallwood
Esri Contributor

Just to follow on from Joe's comments, 

I believe these are basically the same files contained in an MMPK package, just not packaged.

That's correct. When you take a map offline via the Runtime it creates the same structure as a MobileMapPackage created from Pro just not archived (to allow editing of data). In both cases you can access the data using the MobileMapPackage API in Runtime bu supplying the path to the .mmpk file or to the directory.

the number of pre-packaged maps is very limited (I believe 16 per web map)

Also correct. You can create new copies of the webmap if you require more areas.

If you want to go the route of taking individual layers offline, the relevant Runtime API is the GenerateGeodatabaseSyncTask.

We definitely recommend using the Runtime APIs to take maps/layers offline. Whilst you could do this directly via the REST API you would need to handle authentication, edit validation, error handling etc. yourself. Using the Runtime API takes care of these things for you and also gives access to the other parts of the API for visualizing and analysing your data etc.

0 Kudos