Use the AGSOfflineMapTask, with the overrides, to take a webmap offline. The overrides workflow allows you to adjust the settings used for taking each layer in the map offline. For a simple example of how you take a map offline, please consult the Generate Offline Map sample.
Some example use cases for the overrides approach could be when you need to:
- adjust the extent for one or more layers to be different to the rest of the map.
- reduce the amount of data (for example tile data) downloaded for one or more layers in the map.
- filter features to be taken offline.
- take features with no geometry offline - for example, features whose attributes have been populated in the office, but which need a site survey for their geometry.
As the web map that is being taken offline contains an Esri basemap, this sample requires that you sign in with an ArcGIS Online organizational account.
How it works
- Follow the prompts to sign into arcgis.com.
- Tap the "Generate Offline Map (Overrides)" button.
- Use the sliders to adjust the minimum and maximum scale levels of the Streets basemap to be taken offline.
- Use the slider to set the buffer radius for the Streets basemap.
- Turn off the switches to skip the System Valves and Service Connections layers.
- Use the slider to set the minimum flow rate for the features from the Hydrant layer.
- Turn off the switch to skip the geometry filter for the water pipes features.
- Click "Start Job".
- Watch the progress bar as the task completes.
- If you changed all the settings, notice the following in the generated map:
- The basemap does not allow you to zoom past a certain range.
- The basemap is padded around the original area of interest.
- The pipe layers extends beyond the target area.
- The System Valves and Service Connections are omitted.
- The Hydrants layer contains a subset of the original features.
Having adjusted the AGSGenerateOfflineMapParameterOverrides to reflect the custom requirements for the offline map, the original parameters and the custom overrides are used to create a AGSGenerateOfflineMapJob object from the offline map task. This job is then started. To provide feedback to the user, the progress property of AGSGenerateOfflineMapJob is displayed in a sheet. Upon successful completion, the map view is updated with the offline map.