I want to create basemap using several map .tpk file.
Basemap creation with one .tpk file works fine:
ArcGISTiledLayer tiledBasemapLayer = new ArcGISTiledLayer(new TileCache("C:\\Users\\user\\Documents\\ArcGIS\\01102020\\map1.tpk");
await tiledBasemapLayer.LoadAsync();
Scene newScene = new Scene();
newScene.Basemap = new Basemap(tiledBasemapLayer);
Scene = newScene;
The question is how to make this with two or more .tpk files?
ArcGISTiledLayer tiledBasemapLayer = new ArcGISTiledLayer(new TileCache("C:\\Users\\user\\Documents\\ArcGIS\\01102020\\map1.tpk", "C:\\Users\\osipa\\Documents\\ArcGIS\\011020200\\map2.tpk") ; -------error "tileCache doesn't contain constructor that takes 2 arguments."
Solved! Go to Solution.
Almost there.
Instead of creating one ArcGISTiledLayer pointing at 2 TPKs, create 2 separate ArcGISTiledLayers, each pointing to one TPK, and add both of those layers to the new Basemap.
Almost there.
Instead of creating one ArcGISTiledLayer pointing at 2 TPKs, create 2 separate ArcGISTiledLayers, each pointing to one TPK, and add both of those layers to the new Basemap.
Here is my soution. if somebody is interested in:
ArcGISTiledLayer tiledBasemapLayer1 = new ArcGISTiledLayer(new TileCache("C:\\Users\\user\\Documents\\ArcGIS\\01102020\\map1.tpk");
await tiledBasemapLayer1.LoadAsync();
ArcGISTiledLayer tiledBasemapLayer2 = new ArcGISTiledLayer(new TileCache("C:\\Users\\user\\Documents\\ArcGIS\\01102020\\map2.tpk");
await tiledBasemapLayer2.LoadAsync();
Scene newScene = new Scene();
newScene.Basemap = new Basemap(new ArcGISTiledLayer[] { tiledBasemapLayer1, tiledBasemapLayer2 });
Scene = newScene;
Note, you don't need to explicitly call LoadAsync() on the layers. The way Runtime handles cascading dependencies will ensure that when the Scene is displayed in a SceneView, the SceneView will internally load the Scene, which will internally load the Basemap, which will internally load the two AGSTiledLayers.
You typically only need to explicitly load a Loadable object if you need to read properties from it.
...but we do recommend you handle the Loaded event to check there were no errors in loading: ILoadable.Loaded Event