Why can't I load a vtpk in the runtime?

857
1
05-29-2018 10:30 PM
NathanMellor
Occasional Contributor

There are ZERO examples for loading a ArcGISVectorTiledLayer from a local vtpk.

When do you plan to support that as mentioned in the documentation?

I assumed that's because it is so simple you can do it just by looking at the documentation.

However, I would like to ask for help because it isn't working.

I tried this:

mMap = new ArcGISMap();

File contourFile = new File(basedir + "wacountour.vtpk");

Log.i(TAG, "File " + contourFile.getAbsolutePath() + " exists? " + contourFile.exists());

String contourUri = Uri.fromFile(contourFile ).toString();

ArcGISVectorTiledLayer waContoursvtpk = new ArcGISVectorTiledLayer(contourFile.getAbsolutePath());
File mapFile = new File(basedir + "washingtonmap.vtpk");

Log.i(TAG, "File " + mapFile.getAbsolutePath() + " exists? " + mapFile.exists());

String mapUri = Uri.fromFile(mapFile).toString();

//ArcGISVectorTiledLayer usMap = new ArcGISVectorTiledLayer("https://www.arcgis.com/sharing/rest/content/items/91d7cbde681040449a01d853d5e30c84/resources/styles/...");
ArcGISVectorTiledLayer waMapvtpk = new ArcGISVectorTiledLayer(mapFile.getAbsolutePath());


mMap.getBasemap().getBaseLayers().add(waMapvtpk);
mMap.getBasemap().getBaseLayers().add(waContoursvtpk);

This fails without any helpful information whatsoever.

Failure is

7003 Invalid response

or

14 File not found.

Depending on the exact arguments to the constructor.

I have checked and made sure the files exist using File.exist().

I have checked the same vtpk files in ArcGIS Pro and they show as expected.

0 Kudos
1 Reply
DevendraKhatri
New Contributor III

I am able to load my vector tile layer successfully on to my map this way ,

String vectorTileCachePath = getVectorFilePath();
ArcGISVectorTiledLayer localVectorTiledLayer = new ArcGISVectorTiledLayer(vectorTileCachePath)
final ArcGISMap map = new ArcGISMap(new Basemap(localVectorTiledLayer));
mMapView.setMap(map);

I have one query though,

I could download the vtpk as part of offlineJob earlier , I am not able to generate this vector file anymore using any of my new features as well, not sure what I am missing.

0 Kudos