Class GenerateOfflineMapParameters

    • Constructor Detail

      • GenerateOfflineMapParameters

        public GenerateOfflineMapParameters()
        Constructs a new GenerateOfflineMapParameters instance containing basic default values. Consider using the convenience method OfflineMapTask.createDefaultGenerateOfflineMapParametersAsync(Geometry) rather than this constructor to get an instance with default values that are tailored for the online map associated with the task.
        Since:
        100.1.0
      • GenerateOfflineMapParameters

        public GenerateOfflineMapParameters​(Geometry areaOfInterest,
                                            double minScale,
                                            double maxScale)
        Constructs a new GenerateOfflineMapParameters instance containing the given values for areaOfInterest, minScale and maxScale, and basic default values for the other properties. Consider using the convenience method OfflineMapTask.createDefaultGenerateOfflineMapParametersAsync(Geometry) rather than this constructor to get an instance with default values that are tailored for the online map associated with the task.

        The area of interest must have a spatial reference. If minScale or maxScale is zero there is no bound on the minimum scale or maximum scale respectively. If both are non-zero, they must both be positive with minScale greater than maxScale.

        Parameters:
        areaOfInterest - the region of the online map that is to be taken offline; must be an Envelope or a Polygon
        minScale - the minimum scale to be taken offline
        maxScale - the maximum scale to be taken offline
        Throws:
        IllegalArgumentException - if areaOfInterest is null
        Since:
        100.1.0
    • Method Detail

      • getAreaOfInterest

        public Geometry getAreaOfInterest()
        Gets the area of interest for the offline map. This is used for the extent of offline tile caches, geodatabases and the offline map's initial viewpoint property (see GeoModel.getInitialViewpoint().

        The supported geometry types for the area of interest are Envelope and Polygon. The area of interest must have a spatial reference.

        Where a Polygon is supplied, features and tiles will be filtered according to the polygon geometry, which can help reduce the size of the resulting offline map. Note that the filtered set of tiles may vary, depending on the underlying service.

        Returns:
        the area of interest, or null if none has been set
        Since:
        100.1.0
        See Also:
        setAreaOfInterest(Geometry)
      • setAreaOfInterest

        public void setAreaOfInterest​(Geometry areaOfInterest)
        Sets the area of interest for the offline map. This is used for the extent of offline tile caches, geodatabases and the offline map's initial viewpoint property.

        The supported geometry types for the area of interest are Envelope and Polygon. The area of interest must have a spatial reference.

        Where a Polygon is supplied, features and tiles will be filtered according to the polygon geometry, which can help reduce the size of the resulting offline map. Note that the filtered set of tiles may vary, depending on the underlying service.

        Parameters:
        areaOfInterest - the region of the online map that is to be taken offline; must be an Envelope or a Polygon
        Throws:
        IllegalArgumentException - if areaOfInterest is null
        Since:
        100.1.0
      • setAttachmentSyncDirection

        public void setAttachmentSyncDirection​(GenerateGeodatabaseParameters.AttachmentSyncDirection attachmentSyncDirection)
        Sets the direction for attachments to be synchronized when syncing offline feature layers. This method should be used in conjunction with setReturnLayerAttachmentOption(ReturnLayerAttachmentOption) to determine which layers should be taken offline with attachments included.

        This property is valid when the service resource sync capabilities includes supportsAttachmentsSyncDirection, otherwise it is ignored. This property works in conjunction with setReturnLayerAttachmentOption(ReturnLayerAttachmentOption) and in some cases may have its value overridden by the ReturnLayerAttachmentOption. The table below shows the valid combinations of values for layer attachment options and attachment sync direction. The Note column explains where the behavior for a given layer may differ from the values set for these properties.

        ReturnLayerAttachmentOption Valid AttachmentSyncDirection Note
        NONE NONE
        UPLOAD
        ALL_LAYERS UPLOAD
        BIDIRECTIONAL
        READ_ONLY_LAYERS NONE Layers with attachments will treat this as AttachmentSyncDirection.BIDIRECTIONAL
        UPLOAD
        BIDIRECTIONAL Layers without attachments will treat this as AttachmentSyncDirection.NONE
        EDITABLE_LAYERS NONE Layers with attachments will treat this as AttachmentSyncDirection.BIDIRECTIONAL
        UPLOAD
        BIDIRECTIONAL Layers without attachments will treat this as AttachmentSyncDirection.NONE

        If GenerateOfflineMapParameters is used in conjunction with GenerateOfflineMapParameterOverrides this property is superseded.

        Parameters:
        attachmentSyncDirection - the attachment sync direction
        Throws:
        IllegalArgumentException - if attachmentSyncDirection is null
        Since:
        100.1.0
        See Also:
        getAttachmentSyncDirection()
      • isContinueOnErrors

        public boolean isContinueOnErrors()
        Indicates whether or not the generate offline map job should continue running in the event of failure to take a layer or table offline.

        If this property is true, failure to take a layer or table offline will not fail the job, and the failure will be exposed in the job result.

        If this property is false, failure to take a layer or table offline will fail the job and no more layers or tables will be taken offline. The layer's or table's error will be available as the job's error.

        Returns:
        true if the job is to continue running in the event of failure to take a layer or table offline, false otherwise
        Since:
        100.4.0
        See Also:
        setContinueOnErrors(boolean)
      • setContinueOnErrors

        public void setContinueOnErrors​(boolean continueOnErrors)
        Sets whether or not the generate offline map job should continue running in the event of failure to take a layer or table offline. The default value is true.

        If this property is true, failure to take a layer or table offline will not fail the job, and the failure will be exposed in the job result.

        If this property is false, failure to take a layer or table offline will fail the job and no more layers or tables will be taken offline. The layer's or table's error will be available as the job's error.

        Parameters:
        continueOnErrors - true if the job is to continue running in the event of failure to take a layer or table offline, false otherwise
        Since:
        100.4.0
      • isDefinitionExpressionFilterEnabled

        public boolean isDefinitionExpressionFilterEnabled()
        Indicates if feature layer definition expressions are used when taking feature layers and tables offline using this GenerateOfflineMapParameters instance.

        If GenerateOfflineMapParameters is used in conjunction with GenerateOfflineMapParameterOverrides this property is superseded.

        Returns:
        true if layer definition expressions are used when taking feature layers and tables offline, false otherwise
        Since:
        100.3.0
        See Also:
        setDefinitionExpressionFilterEnabled(boolean)
      • setDefinitionExpressionFilterEnabled

        public void setDefinitionExpressionFilterEnabled​(boolean definitionExpressionFilterEnabled)
        Sets whether or not feature layer definition expressions are used when taking feature layers and tables offline using this GenerateOfflineMapParameters instance. The default value is true.

        A value of true allows GenerateOfflineMapJob to use the SQL where clause in FeatureLayer.getDefinitionExpression() as a filter when generating offline geodatabases. Applying the definition expression may reduce the number of features taken offline for display and sync. If the value is false this could result in a larger geodatabase than is required to display the feature layer. For tables the definition expression is taken from ServiceFeatureTable.getDefinitionExpression().

        If GenerateOfflineMapParameters is used in conjunction with GenerateOfflineMapParameterOverrides this property is superseded.

        Parameters:
        definitionExpressionFilterEnabled - true to use layer definition expressions when taking feature layers and tables offline, false otherwise
        Since:
        100.3.0
      • setEsriVectorTilesDownloadOption

        public void setEsriVectorTilesDownloadOption​(EsriVectorTilesDownloadOption esriVectorTilesDownloadOption)
        Sets how Esri vector tiled basemap layers will be downloaded.

        This property lets you choose how to download Esri vector tiled basemap layers. It only applies when taking an Esri vector tile basemap service offline.

        When taking an Esri vector tiled basemap service offline (for example to create a VectorTileCache on your device), you can choose from different versions of the service depending on your use case.

        Primary considerations are the download speed and the size of the resulting .vtpk file. Among other things, file size is influenced by the number of fonts downloaded from the service. Esri vector tiled basemap layers use fonts as part of their style resources - see the vector-tile-style documentation. When you take a vector tiled layer offline, these fonts are downloaded as part of the VectorTileCache.

        Esri services also offer an alternative version with a reduced font package size. This omits the large Arial Unicode font, which greatly reduces the download size. You can view the set of reduced font vector tile services here.

        • If you choose EsriVectorTilesDownloadOption.USE_ORIGINAL_SERVICE, the full set of resources used by the original online service, including all fonts, will be downloaded. This increases the download size of the VectorTileCache but ensures that the offline layer will display the same as the original online data.
        • If you choose EsriVectorTilesDownloadOption.USE_REDUCED_FONTS_SERVICE, the smaller set of fonts used by the alternative, for export, version of the service will be downloaded. This reduces the download size of the VectorTileCache but is not suitable for all locales or when your offline vector tiled layer includes certain language characters. For example, this option will not display Chinese, Japanese, Thai, Korean or Georgian characters. If an alternative, for export, version of the service cannot be found, the original service will be used.

        The default value is EsriVectorTilesDownloadOption.USE_ORIGINAL_SERVICE.

        Parameters:
        esriVectorTilesDownloadOption - describes how Esri vector tiled basemap layers will be downloaded
        Throws:
        IllegalArgumentException - if esriVectorTilesDownloadOption is null
        Since:
        100.10.0
        See Also:
        getEsriVectorTilesDownloadOption()
      • isIncludeBasemap

        public boolean isIncludeBasemap()

        Indicates whether or not a basemap will be included in the offline map. The default value is true.

        The paired methods isIncludeBasemap and setIncludeBasemap are superseded if GenerateOfflineMapParameters is used in conjunction with GenerateOfflineMapParameterOverrides.

        If you do not want a basemap in the offline map, then call setIncludeBasemap(boolean) and pass in false. After loading the offline map, your application can programmatically insert a basemap into the map. Note that a programmatically inserted basemap will not be persisted in the map.

        If you want a basemap in the offline map, then set setIncludeBasemap(boolean) and pass in true. You can choose to either:

        Returns:
        true if the basemap will be included in the offline map, false otherwise
        Since:
        100.1.0
        See Also:
        setIncludeBasemap(boolean)
      • getItemInfo

        public OfflineMapItemInfo getItemInfo()
        Gets the offline map item info used for the local item properties in the offline map. If item info has not been set, the properties are copied from the portal item.
        Returns:
        the offline map item info, or null if none has been set
        Since:
        100.1.0
        See Also:
        setItemInfo(OfflineMapItemInfo)
      • setItemInfo

        public void setItemInfo​(OfflineMapItemInfo itemInfo)
        Sets the offline map item info used for the local item properties in the offline map. If this is not set, the properties are copied from the portal item.
        Parameters:
        itemInfo - the offline map item info
        Throws:
        IllegalArgumentException - if itemInfo is null
        Since:
        100.1.0
      • getMaxScale

        public double getMaxScale()
        Gets the maximum scale for how far in to extract tiles from tiled services. This also determines the offline map's maxScale property. The default value of 0 means extract the levels down to the most detailed.
        Returns:
        the maximum scale
        Since:
        100.1.0
        See Also:
        Geodatabase, setMaxScale(double), getMinScale()
      • setMaxScale

        public void setMaxScale​(double maxScale)
        Sets the maximum scale for how far in to extract tiles from tiled services. This also determines the offline map's maxScale property. The default value of 0 means extract the levels down to the most detailed.

        This is used as input for levels of detail for tile cache and vector tile cache. This is not applicable to offline data in a geodatabase. A minScale of 100000 and a maxScale of 500 will select level IDs between 1:500 and 1:100000 scale. A minScale of 0 and a maxScale of 500 will select all global level IDs down to 1:500 scale. A minScale of 100000 and a maxScale of 0 will select level IDs from 1:100000 scale to the most detailed available level.

        If GenerateOfflineMapParameters is used in conjunction with GenerateOfflineMapParameterOverrides this property is superseded for individual layer's tile caches. However, the maxScale will still be used as the offline map's ArcGISMap.getMaxScale() property.

        Note that this property only sets the levels of detail to download for tiled data. The offline basemap layers will use the same max scale as in the online web map (either defined by the service or on the layer itself) to allow zooming in.

        Parameters:
        maxScale - the maximum scale
        Since:
        100.1.0
        See Also:
        Geodatabase, getMaxScale(), setMinScale(double), TileCache, VectorTileCache
      • getMinScale

        public double getMinScale()
        Gets the minimum scale for how far out data will be in tile caches. This also determines the offline map's minScale property. The default value of 0 means extract all the available detailed levels to global scales.
        Returns:
        the minimum scale
        Since:
        100.1.0
        See Also:
        setMinScale(double), getMaxScale()
      • setMinScale

        public void setMinScale​(double minScale)
        Sets the minimum scale for how far out data will be in tile caches. This also determines the offline map's minScale property. The default value of 0 means extract all the available detailed levels to global scales.

        This is used as input for levels of detail for tile cache. This is not applicable to offline data in a vector tile cache or geodatabase. A minScale of 100000 and a maxScale of 500 will select level IDs between 1:500 and 1:100000 scale. A minScale of 0 and a maxScale of 500 will select all global level IDs down to 1:500 scale. A minScale of 100000 and a maxScale of 0 will select level IDs from 1:100000 scale to the most detailed available level.

        If GenerateOfflineMapParameters is used in conjunction with GenerateOfflineMapParameterOverrides, minScale is superseded for individual layer's tile caches.

        Note that this method only sets the levels of detail to download for tiled data. The offline basemap layers will use the same minScale as in the online web map (either defined by the service or on the layer itself).

        Parameters:
        minScale - the minimum scale
        Since:
        100.1.0
        See Also:
        getMinScale(), setMaxScale(double)
      • setReturnLayerAttachmentOption

        public void setReturnLayerAttachmentOption​(GenerateOfflineMapParameters.ReturnLayerAttachmentOption attachmentOption)
        Sets which feature layers will include attachments when being taken offline. Attachments can be included with none of the layers, all of the layers, read only layers or editable layers. This method should be used in conjuction with setAttachmentSyncDirection(GenerateGeodatabaseParameters.AttachmentSyncDirection) to control how the attachments are synced.

        For offline maps, a feature layer is considered to be editable if the feature service has capabilities that include any of create, update or delete. A read-only layer is one that supports sync, but does not have any of create, update or delete capability. Service capabilities are accessible from service infos, see ArcGISFeatureServiceInfo.getFeatureServiceCapabilities() or ArcGISFeatureLayerInfo.getCapabilities().

        This property works in conjunction with setAttachmentSyncDirection(GenerateGeodatabaseParameters.AttachmentSyncDirection) and in some cases may override the AttachmentSyncDirection. The table below shows the valid combinations of values for layer attachment options and attachment sync direction. The notes column explains where the behavior for a given layer may differ from the values set for these properties.

        ReturnLayerAttachmentOption Valid AttachmentSyncDirection Note
        NONE NONE
        UPLOAD
        ALL_LAYERS UPLOAD
        BIDIRECTIONAL
        READ_ONLY_LAYERS NONE Layers with attachments will treat this as AttachmentSyncDirection.BIDIRECTIONAL
        UPLOAD
        BIDIRECTIONAL Layers without attachments will treat this as AttachmentSyncDirection.NONE
        EDITABLE_LAYERS NONE Layers with attachments will treat this as AttachmentSyncDirection.BIDIRECTIONAL
        UPLOAD
        BIDIRECTIONAL Layers without attachments will treat this as AttachmentSyncDirection.NONE

        If GenerateOfflineMapParameters is used in conjunction with GenerateOfflineMapParameterOverrides, this property is superseded.

        Parameters:
        attachmentOption - indicates which types of layer, if any, will include attachments
        Throws:
        IllegalArgumentException - if attachmentOption is null
        Since:
        100.1.0
        See Also:
        getReturnLayerAttachmentOption()
      • isReturnSchemaOnlyForEditableLayers

        public boolean isReturnSchemaOnlyForEditableLayers()
        Indicates whether or not feature layers taken offline should be schema only and contain no data.

        If GenerateOfflineMapParameters is used in conjunction with GenerateOfflineMapParameterOverrides this property is superseded.

        Returns:
        true if the offline layers will be schema only, false otherwise
        Since:
        100.1.0
        See Also:
        setReturnSchemaOnlyForEditableLayers(boolean)
      • setReturnSchemaOnlyForEditableLayers

        public void setReturnSchemaOnlyForEditableLayers​(boolean schemaOnly)
        Sets whether or not feature layers taken offline should be schema only and contain no data. The default value is false.

        For an upload only type workflow, this property can be set to true to take feature layers offline with no existing data in them.

        If GenerateOfflineMapParameters is used in conjunction with GenerateOfflineMapParameterOverrides this property is superseded.

        Parameters:
        schemaOnly - true to have offline feature layers with schema only, false otherwise
        Since:
        100.1.0
      • setReferenceBasemapFilename

        public void setReferenceBasemapFilename​(String referenceBasemapFilename)
        Sets the name of a local basemap file on the device which can be used rather than downloading an online basemap.

        The local basemap filename must end with .tpk, .tpkx or .vtpk since these are the supported file formats. This property can be read directly from settings applied by the author of the online webmap (see ArcGISMap.getOfflineSettings()) or set by user code to a file known to be on the device. This property will be populated from online settings when created with OfflineMapTask.createDefaultGenerateOfflineMapParametersAsync(Geometry).

        If you wish to use the specified local basemap rather than downloading, you must also set setReferenceBasemapDirectory(java.lang.String). If the directory does not exist, or does not contain the specified basemap, the GenerateOfflineMapJob will fail.

        The spatial reference of the reference basemap is used for the offline map when it is different to the online map's spatial reference. Note that this property is ignored if isIncludeBasemap() is false.

        Parameters:
        referenceBasemapFilename - the filename of the reference basemap
        Throws:
        IllegalArgumentException - if referenceBasemapFilename is null
        Since:
        100.5.0
      • getReferenceBasemapFilename

        public String getReferenceBasemapFilename()
        Gets the name of a local basemap file on the device which can be used rather than downloading an online basemap.
        Returns:
        the file name of the local basemap
        Since:
        100.5.0
        See Also:
        setReferenceBasemapFilename(String)
      • getOnlineOnlyServicesOption

        public GenerateOfflineMapParameters.OnlineOnlyServicesOption getOnlineOnlyServicesOption()
        Describes how data that requires an online service will be handled when taking a map offline.

        Online layers and tables cannot be taken offline in the following situations:

        • The layer or table is using a service that cannot be taken offline. For example, WmsLayer or WmtsLayer.
        • The layer or table is using a service that supports offline, such as an {code ArcGISFeatureLayer}, but synchronization has not been enabled on the service (FeatureServiceCapabilities.isSupportsSync() is set to false). Services utilize synchronization to take layers and tables offline and synchronize changes.

        Online services that cannot be taken offline are referred to as online-only services. Online-only services require network connectivity and may involve authentication. Examples of online-only services include:

        • Dynamic information, such as changing weather or traffic conditions, that delivers frequent and regular updates to the app.
        • Large datasets that would be impractical to take offline to a device.

        This property allows you to specify how online-only data will be handled when taking the map offline. There are three options:

        The default value is GenerateOfflineMapParameters.OnlineOnlyServicesOption.EXCLUDE.

        Returns:
        an enum that describes how data that requires an online service will be handled when taking a map offline
        Since:
        100.9.0
      • setOnlineOnlyServicesOption

        public void setOnlineOnlyServicesOption​(GenerateOfflineMapParameters.OnlineOnlyServicesOption onlineOnlyServicesOption)
        Describes how data that requires an online service will be handled when taking a map offline.

        Online layers and tables cannot be taken offline in the following situations:

        • The layer or table is using a service that cannot be taken offline. For example, WmsLayer or WmtsLayer.
        • The layer or table is using a service that supports offline, such as an {code ArcGISFeatureLayer}, but synchronization has not been enabled on the service (FeatureServiceCapabilities.isSupportsSync() is set to false). Services utilize synchronization to take layers and tables offline and synchronize changes.

        Online services that cannot be taken offline are referred to as online-only services. Online-only services require network connectivity and may involve authentication. Examples of online-only services include:

        • Dynamic information, such as changing weather or traffic conditions, that delivers frequent and regular updates to the app.
        • Large datasets that would be impractical to take offline to a device.

        This property allows you to specify how online-only data will be handled when taking the map offline. There are two options:

        The default value is GenerateOfflineMapParameters.OnlineOnlyServicesOption.EXCLUDE.

        Parameters:
        onlineOnlyServicesOption - describes how data that requires an online service will be handled when taking a map offline
        Throws:
        IllegalArgumentException - if onlineOnlyServicesOption is null
        Since:
        100.9.0