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.
How it works
- Follow the prompts to sign into arcgis.com.
- Click 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.
- Uncheck the checkboxes 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.
- Uncheck the checkbox 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.
The sample creates a AGSPortalItem object using a web map’s ID. This portal item is also used to initialize a map and an AGSOfflineMapTask object. When the button is clicked, the sample requests the default parameters for the task, with the selected extent, by calling defaultGenerateOfflineMapParameters on the AGSOfflineMapTask. Once the parameters are retrieved, they are used to create a set of AGSGenerateOfflineMapParameterOverrides by calling generateOfflineMapParameterOverrides on the same AGSOfflineMapTask. The overrides are then adjusted so that specific layers will be taken offline using custom settings.
For a simple example of how you take a map offline, please consult the "Generate Offline Map" sample. For applications where you just need to take all layers offline, use the standard workflow (using only AGSGenerateOfflineMapParameters). For more fine-grained control over the data you are taking offline, use overrides to adjust the settings for each layer (AGSGenerateOfflineMapParameters in conjunction with AGSGenerateOfflineMapParameterOverrides). 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.