Select to view content in your preferred language

How to use an ItemResourceCache object with the ArcGISVectorTiledLayer constructor for an offline VTPK

57
0
13 hours ago
Labels (2)
LeeCarter
New Contributor II

We have a ArcGIS Maps SDK for Qt (C++ not QML) based application that has an offline vector tile package basemap layer constructed as shown below before then being appended to the basemap layers:

ArcGISVectorTiledLayer* basemapLayer_p = new ArcGISVectorTiledLayer(new VectorTileCache(vectorBasemapFilename, this), this);

Where  "vectorBasemapFilename" is the location/filename on disk of the vtpk file.

This works fine, but we would like to style the map differently in certain situations, for example to be able to support application having light and dark display modes.

I know the vtpk file is just an archive and within it is a file (2MB of JSON format data?) that contains the styling information used by default with the vtpk.  Our vtpk file is large (over 50GB) so I don't want to duplicate that in order to have a different styling applied.

I believe that I should be able to create the ArcGISVectorTiledLayer using a different constructor that would allow a different styling to be applied to that layer:

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

Where the "ItemResourceCache*" argument would be constructed using the path to a disk file, similar how we make the VectorTileCache already:

ItemResourceCache::ItemResourceCache(const QString &path, QObject *parent = nullptr)

I cannot find any examples of ItemResourceCache being used or details of what the file referenced by the "path" argument to the constructor should contain and how to create the file.

I would be grateful if anyone can direct me to or provide information on what the local file needed to populate an ItemResourceCache object should be/contain and how to make one. 

Is using the online style editor an option and if so how and does that result in a style that will want/try to access the Internet resources when used (which would be unacceptable as our application has no Internet access when in use).

0 Replies