hello
i want to use tpk for elevation and bas map for quest 2 VR with unity.
copy the tpk file in "/sdcard/Android/obb/com.Riaka.VRTutorials/" but in app dont show base map and elevation map.
string world2 = "/sdcard/Android/obb/com.Riaka.VRTutorials/world.tpk";
string Elevationfile2 = "/sdcard/Android/obb/com.Riaka.VRTutorials/ShirazDem.tpk";
mapComponent.Basemap = world2;
mapComponent.Elevation = Elevationfile2;
Hi there,
Attached to this response is a unity c# script to allow you to load the files manually rather than through the online data services. Currently in the script, it will only load an SLPK, however this can easily be swapped out for your TPK. Attach the script to the ArcGISMap Game Object so it can get the necessary references. In terms of doing the same process for the basemap and elevation, it should be attached in the script, however we have not tested it on a device, only the SLPK you see in the script loaded through Application.PersistentDataPath + "/Name of SLPK". You should be able to change the link to elevation and basemap. On Android devices, the Application.PersistentDatapath can be found here.
Hope this helps,
Mason
thank you for your solution. I test your code and copy tpk file to directory and check file.exist is false and app can not find the files and ardsdk dont show and use from tpk file.
the directory Application.persistentDataPath="/sdcard/Android/data/com.Riaka.VRTutorials/files/ShirazDem.tpk"
is it need to do some config in player setting or copy to specific folder?
No, there shouldn't be any config needed to get it working. I have not personally testing on a Quest headset, rather a different Android Device. I can test this script on the quest later today and get back to you.
**
i solved the problem in android mobile and i am going to test on quest .
for offline use this code:
private ArcGISMapComponent arcGISMapComponent;
private void Awake()
{
arcGISMapComponent = GetComponent<ArcGISMapComponent>();
}
void Start()
{
if (Application.platform == RuntimePlatform.Android)
{
var arcGISMap = new Esri.GameEngine.Map.ArcGISMap(arcGISMapComponent.MapType);
// Set the Basemap
arcGISMap.Basemap = new Esri.GameEngine.Map.ArcGISBasemap(Application.persistentDataPath + "/shiraz15.tpk", ArcGISLayerType.ArcGISImageLayer, APIKey);
// arcGISMap.Elevation = new Esri.GameEngine.Map.ArcGISMapElevation(new Esri.GameEngine.Elevation.ArcGISImageElevationSource("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer", "Elevation", ""));
arcGISMap.Elevation = new Esri.GameEngine.Map.ArcGISMapElevation(new Esri.GameEngine.Elevation.ArcGISImageElevationSource(Application.persistentDataPath + "/ShirazDem.tpk", "Terrain 3D", ""));
//add layer
var buildingLayer = new Esri.GameEngine.Layers.ArcGIS3DObjectSceneLayer(Application.persistentDataPath + "/Building2.slpk", "Building 2", 1.0f, true, "");
arcGISMap.Layers.Add(buildingLayer);
var Postelayer = new Esri.GameEngine.Layers.ArcGIS3DObjectSceneLayer(Application.persistentDataPath + "/Poste.slpk", "Building 2", 1.0f, true, "");
arcGISMap.Layers.Add(Postelayer);
//add layer
arcGISMapComponent.View.Map = arcGISMap;
}
}