Class ArcGISTiledLayer

  • All Implemented Interfaces:
    ApiKeyResource, RemoteResource, LayerContent, Loadable

    public final class ArcGISTiledLayer
    extends ImageTiledLayer
    implements RemoteResource, ApiKeyResource
    Displays data from a ArcGIS Map service using pre-generated tiles.

    ArcGIS tiled layers consume image tiles provided by an ArcGIS map service or a tile package. Raster tiles are cached by the server at various scales instead of dynamically generating map images at the request of the client application. The client requests the tiles needed at a particular map extent. 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. You can tell if an ArcGIS map server is hosting a compatible ArcGISTiledLayer when "Single Fused Map Cache" is true in the ArcGIS REST Services Directory.

    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:
    Layer, ImageTiledLayer
    • Constructor Detail

      • ArcGISTiledLayer

        public ArcGISTiledLayer​(PortalItem portalItem)
        Creates a new ArcGISTiledLayer based on a map service PortalItem.

        If the portal item argument is not in LoadStatus#LOADED state it will be loaded automatically when this ArcGISTiledLayer instance is loaded.

        Parameters:
        portalItem - a map service PortalItem
        Throws:
        IllegalArgumentException - if portalItem is null
        Since:
        100.0.0
      • ArcGISTiledLayer

        public ArcGISTiledLayer​(String url)
        Creates a new ArcGIS tiled layer from a map service or map service portal item at the given URL.

        To use a credential, call setCredential(Credential) after this constructor and before loading or using this layer.

        If the specified URI is a portal item URL (see PortalItem for the supported URL formats), the underlying PortalItem will be created and accessible through Layer.getItem().

        Parameters:
        url - the map service or portal item URL
        Throws:
        IllegalArgumentException - if the URL is null or empty
        Since:
        100.0.0
        See Also:
        PortalItem, PortalItem(Portal, String)
      • ArcGISTiledLayer

        public ArcGISTiledLayer​(TileCache tileCache)
        Creates a new ArcGIS tiled layer from a tile cache.

        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 Detail

      • 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 tile cache of this tiled layer if it references a tile cache (offline layer).
        Returns:
        the tile cache of this tiled layer or null if this layer references an online service
        Since:
        100.9.0
        See Also:
        ArcGISTiledLayer(TileCache)
      • 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
      • getUri

        public String getUri()
        Gets the URL of the tiled layer.
        Specified by:
        getUri in interface RemoteResource
        Returns:
        the URL of the tiled layer
        Since:
        100.0.0
      • getMapServiceInfo

        public ArcGISMapServiceInfo getMapServiceInfo()
        Gets the map service information for this layer.
        Returns:
        map service information for this layer
        Since:
        100.0.0
      • getSublayers

        public ListenableList<ArcGISSublayer> getSublayers()
        Gets the sublayers for this layer.
        Returns:
        an unmodifiable list of ArcGISSublayers
        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 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. Setting the API key on a specific ApiKeyResource overrides the default key set on ArcGISRuntimeEnvironment.getApiKey().

        Specified by:
        getApiKey in interface ApiKeyResource
        Returns:
        the API key to access API key enabled services and resources in ArcGIS Online
      • 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. Setting the API key on a specific ApiKeyResource overrides the default key set on ArcGISRuntimeEnvironment.getApiKey().

        Specified by:
        setApiKey in interface ApiKeyResource
        Parameters:
        apiKey - the API key to access API key enabled services and resources in ArcGIS Online
      • 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