ArcGISVectorTiledLayer Class

  • ArcGISVectorTiledLayer
  • class Esri::ArcGISRuntime::ArcGISVectorTiledLayer

    A layer that can visualize data from an ArcGIS vector tile service or a local VectorTileCache. More...

    Header: #include <ArcGISVectorTiledLayer.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::Layer, Esri::ArcGISRuntime::ApiKeyResource, and Esri::ArcGISRuntime::RemoteResource

    Public Functions

    ArcGISVectorTiledLayer(const QUrl &url, QObject *parent = nullptr)
    ArcGISVectorTiledLayer(const QUrl &url, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)
    ArcGISVectorTiledLayer(Esri::ArcGISRuntime::Item *item, QObject *parent = nullptr)
    ArcGISVectorTiledLayer(Esri::ArcGISRuntime::VectorTileCache *vectorTileCache, QObject *parent = nullptr)
    ArcGISVectorTiledLayer(Esri::ArcGISRuntime::VectorTileCache *vectorTileCache, Esri::ArcGISRuntime::ItemResourceCache *itemResourceCache, QObject *parent = nullptr)
    virtual ~ArcGISVectorTiledLayer() override
    Esri::ArcGISRuntime::ItemResourceCache *itemResourceCache() const
    Esri::ArcGISRuntime::VectorTileSourceInfo sourceInfo() const
    Esri::ArcGISRuntime::VectorTileStyle style() const
    Esri::ArcGISRuntime::VectorTileCache *vectorTileCache() const

    Reimplemented Public Functions

    virtual QString apiKey() const override
    virtual Esri::ArcGISRuntime::Credential *credential() const override
    virtual Esri::ArcGISRuntime::RequestConfiguration requestConfiguration() const override
    virtual void setApiKey(const QString &apiKey) override
    virtual void setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration) override
    virtual QUrl url() const override

    Detailed Description

    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 URL or a portal item. The URL 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 URL 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 URL to a vector tile source. The source must be in the Mapbox TileJSON format. The source info includes a URL 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.

    Example:

    Display the Navigation vector tile layer by using an online service:

    // create a vector tiled basemap
    ArcGISVectorTiledLayer* vectorTiledLayer = new ArcGISVectorTiledLayer(QUrl("https://www.arcgis.com/home/item.html?id=7675d44bb1e4428aa2c30a9b68f97822"), this);
    Basemap* basemap = new Basemap(vectorTiledLayer, this);
    // create a new map instance
    m_map = new Map(basemap, this);

    Alternatively, you can display vector tiles offline by setting the file path to a local vector tile package (*.vtpk):

    // Load the basemap from a vector tile package
    const QString vtpkDataPath = defaultDataPath() + "/ArcGIS/Runtime/Data/vtpk/FillmoreTopographicMap.vtpk";
    ArcGISVectorTiledLayer* fillmoreVTPK = new ArcGISVectorTiledLayer(QUrl::fromLocalFile(vtpkDataPath), this);
    Basemap* fillmoreBasemap = new Basemap(fillmoreVTPK, this);
    m_map = new Map(fillmoreBasemap, this);

    See sample: Vector tiled layer (URL)

    See also Layer and https://developers.arcgis.com/qt/cpp/sample-code/arcgis-vector-tiled-layer-url/.

    Member Function Documentation

    [explicit] ArcGISVectorTiledLayer::ArcGISVectorTiledLayer(const QUrl &url, QObject *parent = nullptr)

    Creates an ArcGIS Vector Tiled Layer from an ArcGIS Vector Tile Service URL, a Vector Tile Style Sheet URL, or a path to a local vector tile package (.vtpk) file.

    • url - ArcGIS Vector Tile Service URL, an ArcGIS Vector Tile Style Sheet URL, or a path to a local vector tile package (.vtpk) file.
    • parent - The optional parent QObject.

    {ArcGISVectorTiledLayer(Esri::ArcGISRuntime::Item*, QObject*)}

    See also Esri::ArcGISRuntime::ArcGISVectorTiledLayer::ArcGISVectorTiledLayer(Esri::ArcGISRuntime::Item*, QObject*).

    ArcGISVectorTiledLayer::ArcGISVectorTiledLayer(const QUrl &url, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)

    Constructor that accepts the URL (url), a credential, and an optional parent.

    The credential is applied if the provided URL is to a secured service.

    [explicit] ArcGISVectorTiledLayer::ArcGISVectorTiledLayer(Esri::ArcGISRuntime::Item *item, QObject *parent = nullptr)

    Creates an ArcGIS Vector Tiled Layer from a PortalItem.

    • item - An Item.
    • parent - The optional parent QObject.

    See also ArcGISVectorTiledLayer(const QUrl&, QObject*).

    [explicit, since Esri::ArcGISRuntime 100.2] ArcGISVectorTiledLayer::ArcGISVectorTiledLayer(Esri::ArcGISRuntime::VectorTileCache *vectorTileCache, QObject *parent = nullptr)

    Creates an ArcGIS Vector Tiled Layer from a vector tile cache.

    {ArcGISVectorTiledLayer(const QUrl&, QObject*)}

    This function was introduced in Esri::ArcGISRuntime 100.2.

    See also Esri::ArcGISRuntime::ArcGISVectorTiledLayer::ArcGISVectorTiledLayer(const QUrl&, QObject*).

    [since Esri::ArcGISRuntime 100.2] ArcGISVectorTiledLayer::ArcGISVectorTiledLayer(Esri::ArcGISRuntime::VectorTileCache *vectorTileCache, Esri::ArcGISRuntime::ItemResourceCache *itemResourceCache, QObject *parent = nullptr)

    Creates an ArcGIS Vector Tiled Layer from a vector tile cache and an item resource cache containing a custom style for this vector tile layer.

    • vectorTileCache - A VectorTileCache.
    • itemResourceCache - The item resource cache contains a custom style.
    • parent - The optional parent QObject.

    {ArcGISVectorTiledLayer(const QUrl&, QObject*)}

    This function was introduced in Esri::ArcGISRuntime 100.2.

    See also Esri::ArcGISRuntime::ArcGISVectorTiledLayer::ArcGISVectorTiledLayer(const QUrl&, QObject*).

    [override virtual] ArcGISVectorTiledLayer::~ArcGISVectorTiledLayer()

    Destructor.

    [override virtual, since Esri::ArcGISRuntime 100.10] QString ArcGISVectorTiledLayer::apiKey() const

    Reimplements: ApiKeyResource::apiKey() const.

    Returns the API key allows your app to access ArcGIS location services and private portal items.

    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.

    Note: An API key created with a referrer is not supported. If you need service requests to include the referrer, use the SDK's functionality to intercept the request and add an HTTP referer header.

    In addition to setting an ArcGISRuntimeEnvironment::apiKey at a global level for your application, you can set it on any class that implements ApiKeyResource. This overrides the ArcGISRuntimeEnvironment::apiKey and enables more granular usage telemetry and management of ArcGIS location resources used by your app.

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

    For more information, see API key authentication and Types of authentication.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    See also setApiKey().

    [override virtual] Esri::ArcGISRuntime::Credential *ArcGISVectorTiledLayer::credential() const

    Reimplements: RemoteResource::credential() const.

    Returns the security credential used to access the tiled service.

    This property is available if the service is secured.

    [since Esri::ArcGISRuntime 100.2] Esri::ArcGISRuntime::ItemResourceCache *ArcGISVectorTiledLayer::itemResourceCache() const

    Returns the item resource cache contains a custom style that can be applied to this layer.

    This method can only be called if the layer load status is LoadStatus::NotLoaded or LoadStatus::FailedToLoad otherwise ErrorType::CommonIllegalState error will emit.

    {ArcGISVectorTiledLayer(Esri::ArcGISRuntime::VectorTileCache*, QObject*)}

    This function was introduced in Esri::ArcGISRuntime 100.2.

    See also Esri::ArcGISRuntime::ArcGISVectorTiledLayer::ArcGISVectorTiledLayer(Esri::ArcGISRuntime::VectorTileCache*, QObject*).

    [override virtual, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::RequestConfiguration ArcGISVectorTiledLayer::requestConfiguration() const

    Reimplements: RemoteResource::requestConfiguration() const.

    Returns the RequestConfiguration in use by this layer.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also setRequestConfiguration().

    [override virtual, since Esri::ArcGISRuntime 100.10] void ArcGISVectorTiledLayer::setApiKey(const QString &apiKey)

    Reimplements: ApiKeyResource::setApiKey(const QString &apiKey).

    Sets the apiKey to apiKey.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    See also apiKey.

    [override virtual, since Esri::ArcGISRuntime 100.1] void ArcGISVectorTiledLayer::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration)

    Reimplements: RemoteResource::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration).

    Sets requestConfiguration used for network requests sent by this layer.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also requestConfiguration().

    Esri::ArcGISRuntime::VectorTileSourceInfo ArcGISVectorTiledLayer::sourceInfo() const

    Returns information about the vector tile layer's source.

    The returned VectorTileSource includes name, extent, visible scale, and so on.

    Esri::ArcGISRuntime::VectorTileStyle ArcGISVectorTiledLayer::style() const

    Returns information about the style sheet used with this vector tiled layer.

    The returned VectorTileStyle includes the style sheet's URL, version, and so on.

    [override virtual] QUrl ArcGISVectorTiledLayer::url() const

    Reimplements: RemoteResource::url() const.

    Returns the URL of the ArcGIS vector tiled layer.

    {ArcGISTiledLayer::ArcGISTiledLayer(const QUrl&, QObject*)}, {Esri::ArcGISRuntime::ArcGISVectorTiledLayer::ArcGISVectorTiledLayer(const QUrl&, QObject*)} {ArcGISVectorTiledLayer(const QUrl&, QObject*)}

    See also Esri::ArcGISRuntime::ArcGISTiledLayer::ArcGISTiledLayer(const QUrl&, QObject*).

    [since Esri::ArcGISRuntime 100.2] Esri::ArcGISRuntime::VectorTileCache *ArcGISVectorTiledLayer::vectorTileCache() const

    Returns the underlying vector tile cache or nullptr if no vector tile cache is present.

    If this layer was created from a vector tile cache or a local file URL, then this property will return the vector tile cache. If this layer was created from a remote URL, this property will return nullptr.

    {ArcGISVectorTiledLayer(Esri::ArcGISRuntime::VectorTileCache*, QObject*)}

    This function was introduced in Esri::ArcGISRuntime 100.2.

    See also Esri::ArcGISRuntime::ArcGISVectorTiledLayer::ArcGISVectorTiledLayer(Esri::ArcGISRuntime::VectorTileCache*, QObject*).

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.