I have created an offline application which uses the ArcGISLocalTileLayer function to display the map. The app loads fully when testing through the Qt Creator but the map doesn't appear when the app's loaded through the Player. Is there anything that I can do to the code to fix this?
Make sure to create a data folder in your app directory. Add the tpk to the data folder. I have tested this sample code and it works on both android and iPad. Can you please test it by uploading this sample and test it in the player?
import QtQuick 2.3
import QtQuick.Controls 1.2
import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Controls 1.0
import ArcGIS.AppFramework.Runtime 1.0
App {
id: app
width: 800
height: 532
property string runtimePath: AppFramework.userHomeFolder.filePath("ArcGIS/Runtime")
property string dataPath: runtimePath + "/Data"
property string inputTPK: "test.tpk"
property string outputTPK: dataPath + "/" + inputTPK
function copyLocalData(input, output) {
var resourceFolder = AppFramework.fileFolder(app.folder.folder("Data").path);
AppFramework.userHomeFolder.makePath(dataPath);
resourceFolder.copyFile(input, output);
return output
}
Envelope {
id: sfExtent
xMin: -13643665.582273144
yMin: 4533030.152110769
xMax: -13618899.985108782
yMax: 4554203.2089457335
Map {
id: myMap
anchors.fill: parent
extent: sfExtent
focus: true
ArcGISLocalTiledLayer {
path: copyLocalData(inputTPK, outputTPK)
I tried adding in the userHomePath but the AppStudio player is still not able to display the imagery.
You will need to specify the path to these TPKs. In the case of AppStudio, a good cross platform method is to use is the AppFramework.userHomePath property. This will return to you the "user home" location on each device. In the case of iOS, that would be <application_bundle>/Documents. So, in your code, you could say "path: AppFramework.userHomePath + "/WairarapaImagery.tpk", and then make sure to transfer your TPK to that location on your device (usually via iTunes).
Here's the code for the section that holds the tiled layer components
App { id: app width: 1220 height: 880 property color penColor: colorDialog.color; property int penWidth; Rectangle {...} Map { id: map anchors {...} rotationByPinchingEnabled: true zoomByPinchingEnabled: true positionDisplay { positionSource: PositionSource { } } ArcGISLocalTiledLayer { id:aerials path: "WairarapaImagery.tpk" } ArcGISLocalTiledLayer { id: vector path: "WairarapaVector.tpk" } ... }
width: 1220
height: 880
property color penColor: colorDialog.color;
property int penWidth;
Rectangle {...}
id: map
anchors {...}
rotationByPinchingEnabled: true
zoomByPinchingEnabled: true
positionDisplay {
positionSource: PositionSource {
id:aerials
path: "WairarapaImagery.tpk"
id: vector
path: "WairarapaVector.tpk"
...
What does your path look like for referencing the local tiled layer?
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.