Class ArcGISVectorTiledLayer

java.lang.Object
com.esri.arcgisruntime.layers.Layer
com.esri.arcgisruntime.layers.ArcGISVectorTiledLayer
All Implemented Interfaces:
ApiKeyResource, RemoteResource, LayerContent, Loadable

public final class ArcGISVectorTiledLayer extends Layer implements RemoteResource, ApiKeyResource
A layer that can visualize data from an ArcGIS vector tile service or a local VectorTileCache.

An ArcGIS vector tiled layer displays vector tiles from an online vector tile service or a local vector tile cache (.vtpk file). Vector tiled layers are appropriate for basemap, reference, and possibly operational layers. They do not contain feature data, and do not support identify, search, or editing operations.

Vector tiles are an alternative to raster tile basemap layers, such as ArcGISTiledLayer. Instead of pixels (raster), the cartography is delivered using 2D points. The points describe lines, polygons, or the locations of labels and marker symbols. The file format of vector tiles is binary and conforms to the Mapbox Vector Tile Specification. This specification allows a more continuous visual experience between levels of detail compared to raster tiles. The vector tile file format requires less space than raster tiles and is optimized to reduce network bandwidth.

You can create a vector tiled layer using either a URI or a portal item. The URI can point to a vector tile source, a vector tile style sheet, or a local vector tile package (.vtpk) file. The portal item will contain a URI to a vector tile style sheet. The style sheet describes the appearance of the geometry and must be in the Mapbox GL Style format. The style sheet also contains a URI to a vector tile source. The source must be in the Mapbox TileJSON format. The source info includes a URI to a default style sheet.

More than one vector tile style sheet can use the same source. Both the source info and the style sheet are human readable JSON files.

You can also download vector tiles from an online vector tile service using ExportVectorTilesTask. The downloaded vector tile package is a single file (.vtpk) that contains all of the tile data files, the source information, a style sheet, and the font and symbol marker resources required to display the map.

Vector tile packages can be distributed inside mobile map packages (.mmpk). The mobile map package JSON can point to the location of the vector tile style sheet or the root of the vector tile package data.

More information and reference samples on the ArcGIS developer website:

Since:
100.0.0
See Also:
  • Constructor Details

    • ArcGISVectorTiledLayer

      public ArcGISVectorTiledLayer(String dataSourceUri)
      Creates an ArcGIS Vector Tiled Layer from an ArcGIS Vector Tile Service URL, a Vector Tile Style Sheet URI, or the path to a local vector tile package (.vtpk) file.
      Parameters:
      dataSourceUri - an ArcGIS Vector Tile Service URL, an ArcGIS Vector Tile Style Sheet URI, or the path to a local vector tile package (.vtpk) file
      Throws:
      IllegalArgumentException - if dataSourceUri is null or empty
      Since:
      100.0.0
    • ArcGISVectorTiledLayer

      public ArcGISVectorTiledLayer(PortalItem portalItem)
      Creates an ArcGIS Vector Tiled Layer from a PortalItem.
      Parameters:
      portalItem - the PortalItem associated with this ArcGISVectorTiledLayer instance
      Throws:
      IllegalArgumentException - if portalItem is null
      Since:
      100.0.0
    • ArcGISVectorTiledLayer

      public ArcGISVectorTiledLayer(VectorTileCache vectorTileCache)
      Creates an ArcGIS Vector Tiled Layer from a vector tile cache.

      You can download a vector tile cache by using the ExportVectorTilesTask.

      Parameters:
      vectorTileCache - the vector tile cache to use
      Throws:
      IllegalArgumentException - if vectorTileCache is null
      Since:
      100.2.0
    • ArcGISVectorTiledLayer

      public ArcGISVectorTiledLayer(VectorTileCache vectorTileCache, ItemResourceCache itemResourceCache)
      Creates an ArcGIS Vector Tiled Layer from a vector tile cache and an item resource cache containing
      Parameters:
      vectorTileCache - the vector tile cache to use
      itemResourceCache - the item resource cache contains a custom style, may be null
      Throws:
      IllegalArgumentException - if vectorTileCache is null.
      Since:
      100.2.0
  • Method Details

    • getSourceInfo

      public VectorTileSourceInfo getSourceInfo()
      Gets the Vector Tile Source info.
      Returns:
      the source info
      Since:
      100.0.0
    • getStyle

      public VectorTileStyle getStyle()
      Gets the VectorTileStyle.
      Returns:
      the style
      Since:
      100.0.0
    • copy

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

      public VectorTileCache getVectorTileCache()
      Gets the underlying vector tile cache for creating the vector tile layer, or null if no vector tile cache is present.

      If this layer was created from a vector tile cache or a local file URI, then it will return the vector tile cache. If this layer was created from a remote URI, it will return null.

      Returns:
      the vector tile cache or null if no vector tile cache available
      Since:
      100.2.0
    • getItemResourceCache

      public ItemResourceCache getItemResourceCache()
      Gets the item resource cache which contains a custom style that can be applied to this layer.
      Returns:
      the item resource cache or null if no item resource cache available
      Since:
      100.2.0
    • getCredential

      public Credential getCredential()
      Description copied from interface: RemoteResource
      Gets the Credential that is set on the network-enabled resource.

      Only applicable if the resource is secured.

      Specified by:
      getCredential in interface RemoteResource
      Returns:
      the Credential, or null if there is none
    • setCredential

      public void setCredential(Credential credential)
      Description copied from interface: RemoteResource
      Sets a Credential to be used by the network-enabled resource in the event of an authentication challenge. The default credential is null.

      Only applicable if the resource is secured.

      Specified by:
      setCredential in interface RemoteResource
      Parameters:
      credential - the Credential to be used for authentication
    • getRequestConfiguration

      public RequestConfiguration getRequestConfiguration()
      Description copied from interface: RemoteResource
      Gets the RequestConfiguration used to modify the parameters of network requests made by this RemoteResource.
      Specified by:
      getRequestConfiguration in interface RemoteResource
      Returns:
      the RequestConfiguration used to modify network requests
    • setRequestConfiguration

      public void setRequestConfiguration(RequestConfiguration requestConfiguration)
      Description copied from interface: RemoteResource
      Sets the RequestConfiguration used to modify the parameters of network requests made by this RemoteResource. If not set, the global RequestConfiguration will be used (see RequestConfiguration.getGlobalRequestConfiguration()).
      Specified by:
      setRequestConfiguration in interface RemoteResource
      Parameters:
      requestConfiguration - the RequestConfiguration used to modify network requests
    • getUri

      public String getUri()
      Description copied from interface: RemoteResource
      Gets the URI of this RemoteResource. Typically this is the URI used to instantiate the object.
      Specified by:
      getUri in interface RemoteResource
      Returns:
      the URI of this RemoteResource
    • 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: