Class ArcGISTiledLayer

All Implemented Interfaces:
ApiKeyResource, RemoteResource, LayerContent, Loadable

public final class ArcGISTiledLayer extends ImageTiledLayer implements RemoteResource, ApiKeyResource
A layer that can visualize data from an ArcGIS map service or a local TileCache by using previously generated tiles.

ArcGIS tiled layers consume image tiles provided by an ArcGIS map service or a local tile package. Raster tiles are cached at various scales when the map service is created. This API requests the tiles needed at a particular map extent. ArcGISTiledLayer will display data from an ArcGIS MapServer if "Single Fused Map Cache" is set to true in its ArcGIS REST Services Directory.

You can use the ExportTileCacheTask class to generate and download tiles from the service, creating a tile package (.tpk/.tpkx) for use locally on the device. Alternatively, you can use ArcGIS Pro to create a map tile package and provision it to the device.

Functional characteristics

ArcGIS tiled layers do not support re-projection, query, select, identify, or editing.

Performance characteristics

Tiled image layers (those that derive functionality from the ImageTiledLayer class) provide fast display of geographic imagery stored in raster files. These rasters typically contain image data acquired from satellite, aircraft, or drones. The resolution of such imagery can be very high, providing a detailed view. With increased resolution comes increased file sizes and potentially slower performance.

Raster tiling is a process that resamples the pixel size at different scales to create images with the appropriate resolution for each scale. The tiling process creates level-of-detail pyramids to efficiently manage how much detail you see as you zoom in and out on the map. Typically, as you zoom closer to the Earth's surface, you want to see greater detail of the geographic information. Tiled image layers allow you to see just the information you need very quickly based on the level-of-detail pyramid at a particular scale, rather than having to load a single large image at once.

Tiles are generated by the server when the service is created. Requests for tiles are made on multiple threads and handled asynchronously. The size of each returned tile increases as the resolution or complexity of the image in the tile increases. For example, high-resolution imagery tiles can be result in larger file sizes than topographic mapping for the same area and map extent.

Since:
100.0.0
See Also:
  • Constructor Details

    • ArcGISTiledLayer

      public ArcGISTiledLayer(PortalItem portalItem)
      Creates an ArcGIS tiled layer from a PortalItem representing an ArcGIS map service.

      The item's type should be PortalItem.Type.MAP_SERVICE.

      Parameters:
      portalItem - a portal item of type PortalItem.Type.MAP_SERVICE.
      Throws:
      IllegalArgumentException - if portalItem is null
      Since:
      100.0.0
    • ArcGISTiledLayer

      public ArcGISTiledLayer(String url)
      Creates an ArcGIS tiled layer from the specified URL.

      If the specified URI is a map service URL, the MapServer must have "Single Fused Map Cache" set to true in its ArcGIS REST Services Directory. If the specified URI is a portal item URL, the underlying PortalItem is created and can be accessed through Layer.getItem().

      Parameters:
      url - the URL to the REST endpoint of an ArcGIS map service or ArcGIS map service portal item, or the path to a local tile package(.tpk/.tpkx).
      Throws:
      IllegalArgumentException - if the URL is null or empty
      Since:
      100.0.0
      See Also:
    • ArcGISTiledLayer

      public ArcGISTiledLayer(TileCache tileCache)
      Creates an ArcGIS Tiled Layer object from a local cache of previously rendered map tiles.

      The supported file formats:

      • Tiled Package .tpk, which holds data about tiles (images) from an ArcGISMap wrapped in a single file.
      • Exploded Cache, where each tile is stored in a single file.
      • Compact Cache, where groups of tiles are stored together in large files called bundles.

      Can be used to work with tiled layers offline.

      Parameters:
      tileCache - the tile cache to use
      Throws:
      IllegalArgumentException - if argument is null
      Since:
      100.0.0
  • Method Details

    • copy

      public ArcGISTiledLayer copy()
      Creates a deep copy of this ArcGISTiledLayer instance.
      Returns:
      a deep copy of this ArcGISTiledLayer instance, which means that copies of all fields of this layer are made including its loading state
      Since:
      100.1.0
    • getTileCache

      public TileCache getTileCache()
      Gets the local tiled cache.

      This property is populated if the ArcGISTiledLayer has been loaded from a local tile package (.tpk/.tpkx).

      Returns:
      the tile cache of this tiled layer or null if this layer references an online service
      Since:
      100.9.0
      See Also:
    • getRefreshInterval

      public long getRefreshInterval()
      Gets the refresh interval in milliseconds. The refresh interval is the time between automatic layer requests. A value of zero means the layer is never refreshed. The default value is zero.
      Returns:
      the refresh interval in milliseconds
      Since:
      100.1.0
    • setRefreshInterval

      public void setRefreshInterval(long refreshIntervalMilliseconds)
      Sets the refresh interval in milliseconds. The refresh interval is the time between automatic layer requests. A value of zero means the layer is never refreshed. The default value is zero.
      Parameters:
      refreshIntervalMilliseconds - the refresh interval in milliseconds
      Throws:
      IllegalArgumentException - if milliseconds is less than zero
      Since:
      100.1.0
    • setCredential

      public void setCredential(Credential credential)
      Sets the credential used to authenticate the user with the tiled layer.
      Specified by:
      setCredential in interface RemoteResource
      Parameters:
      credential - the credential used to authenticate the user with the tiled layer
      Since:
      100.0.0
    • getCredential

      public Credential getCredential()
      Gets the credential used to authenticate the user with the tiled layer.
      Specified by:
      getCredential in interface RemoteResource
      Returns:
      the credential used to authenticate the user with the tiled layer
      Since:
      100.0.0
    • setRequestConfiguration

      public void setRequestConfiguration(RequestConfiguration requestConfiguration)
      Sets configuration parameters used for network requests sent using this Layer object. The global RequestConfiguration is used if no RequestConfiguration is set.
      Specified by:
      setRequestConfiguration in interface RemoteResource
      Parameters:
      requestConfiguration - object containing the parameters to use
      Since:
      100.0.0
    • getRequestConfiguration

      public RequestConfiguration getRequestConfiguration()
      Gets the RequestConfiguration object in use by this Layer.
      Specified by:
      getRequestConfiguration in interface RemoteResource
      Returns:
      the RequestConfiguration object or null if none has been set
      Since:
      100.0.0
      See Also:
    • getUri

      public String getUri()
      Gets the URL to the endpoint of an ArcGIS map service or the path to a local tile package (.tpk/.tpkx) file.

      The URI is available after the layer has successfully loaded.

      Specified by:
      getUri in interface RemoteResource
      Returns:
      the URI of the map service, or null if none
      Since:
      100.0.0
    • getMapServiceInfo

      public ArcGISMapServiceInfo getMapServiceInfo()
      Gets the ArcGIS map service information.

      This information is available after the layer has successfully loaded.

      Returns:
      map service information for this layer
      Since:
      100.0.0
    • getSublayers

      public ListenableList<ArcGISSublayer> getSublayers()
      Gets the read-only collection sublayers in an ArcGIS tiled layer.
      Returns:
      the read-only collection sublayers in an ArcGIS tiled layer
      Since:
      100.2.0
    • getApiKey

      public String getApiKey()
      Description copied from interface: ApiKeyResource
      Gets the API key to access API key enabled services and resources in ArcGIS Online.

      An API key is a unique long-lived access token that is used to authenticate and monitor requests to ArcGIS location services and private portal items. You can create and manage an API key using your portal when you sign in with an ArcGIS Location Platform account or an ArcGIS Online account with administrator access or a custom role that has the Generate API keys privilege. To learn how to create and manage API keys, go to the Create an API Key tutorial. You must ensure that your API key has the correct privileges to access secure resources.

      In addition to setting an API key at a global level for your application using ArcGISRuntimeEnvironment.setApiKey(String), you can call ApiKeyResource.setApiKey(String) on any class that implements ApiKeyResource. When you call setApiKey(String) on an APIKeyResource, it will override the default key at the global level (the key returned by ArcGISRuntimeEnvironment.getApiKey(), in other words), enabling more granular usage telemetry and management for ArcGIS Online resources used by your app.

      Classes that expose an API key property by implementing APIKeyResource include:

      Specified by:
      getApiKey in interface ApiKeyResource
      Returns:
      the API key to access API key enabled services and resources in ArcGIS Online
      See Also:
    • setApiKey

      public void setApiKey(String apiKey)
      Description copied from interface: ApiKeyResource
      Sets the API key to access API key enabled services and resources in ArcGIS Online.

      An API key is a unique key used to authorize access to specific services and resources in ArcGIS Online. It is also used to monitor access to those services. An API key is created and managed in the ArcGIS developer dashboard and is tied to a specific ArcGIS account.

      In addition to setting an API key at a global level for your application using ArcGISRuntimeEnvironment.setApiKey(String), you can call setApiKey(String) on any class that implements ApiKeyResource. When you call setApiKey(String) on an APIKeyResource, it will override the default key at the global level (the key returned by ArcGISRuntimeEnvironment.getApiKey(), in other words), enabling more granular usage telemetry and management for ArcGIS Online resources used by your app.

      Classes that expose an API key property by implementing APIKeyResource include:

      Specified by:
      setApiKey in interface ApiKeyResource
      Parameters:
      apiKey - the API key to access API key enabled services and resources in ArcGIS Online
      See Also:
    • getTile

      protected byte[] getTile(TileKey tileKey)
      Description copied from class: ImageTiledLayer
      Gets the encoded bytes that represents a tile for the given tile key. The encoding must match TileInfo specified in the constructor ImageTiledLayer(TileInfo, Envelope).
      Specified by:
      getTile in class ImageTiledLayer
      Parameters:
      tileKey - key for the expected tile
      Returns:
      the encoded bytes that represent the tile for the given tile key