Hi there
I created a small TPK using the Tile Package Kreator. I then downloaded the AppStudio Tiled Layer sample app and tried to load my offline TPK - but I was unable to do so, not sure how to load it as sample shows how to load an online TPK.
The specific code to load URL was written as:
Map {
id: map
Basemap {
// Nest an ArcGISVectorTiledLayer Layer in the Basemap
ArcGISVectorTiledLayer {
url: "http://www.arcgis.com/home/item.html?id=dcbbba0edf094eaa81af19298b9c6247"
}
How would I change this to reference a TPK stored locally? The TPK will for now reside in the app's Data folder. Ideally I would like a user to browse to a folder where the TPK is stored but I wont try and attempt to do so now.
Thank you.
Regards
Mervyn
Basemap {
ArcGISTiledLayer {
TileCache {
path: dataPath + "tpk/SanFrancisco.tpk"
}
}
}
More info can be found here
Hi Nakul
Thank you for responding. I have tried this approach but my offline TPK does not load - it does not even give me the grid view with the Esri licence statement that I get when the online map loads.
I then added a property statement for the data path but this did not help. Could you please look at the below code and suggest where I may be going wrong?
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls.Material 2.1
import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Controls 1.0
import Esri.ArcGISRuntime 100.1
App {
id: app
width: 414
height: 736
property real scaleFactor: AppFramework.displayScaleFactor
property string dataPath: AppFramework.userHomeFolder.filePath("ArcGIS/AppStudio/Data")
// Create MapView that contains a Map
MapView {
id: mapView
anchors.fill: parent
Map {
id: map
Basemap {
ArcGISTiledLayer {
TileCache {
path: dataPath + "hoekwil.tpk"
}
}
}
initialViewpoint: ViewpointCenter {
center: Point { x:22.6; y: -33.9; spatialReference: SpatialReference { wkid: 4326 } }
targetScale: 50000
}
}
// Busy Indicator
BusyIndicator {
anchors.centerIn: parent
height: 48 * scaleFactor
width: height
running: true
Material.accent:"#8f499c"
visible: (mapView.drawStatus === Enums.DrawStatusInProgress)
}
}
}
Thank you.
Regards
Mervyn
How can you load a TPK from a button or drop box....
I initially load a TPK file into my app as seen above in this post. But I want a button to change that to a different tpk on the device....How do I do this...
I tried this and nothing...errors....
// SNIP INSIDE BUTTON CLICK
var layer = ArcGISRuntimeEnvironment.createObject("ArcGISTiledLayer");
layer.url = AppFramework.userHomeFolder.filePath("ArcGIS/AppStudio/Data/QuickReport/backgrounddatatpk.tpk");
mapView.map = layer;
// SNIP END OF BUTTON ON CLICK EVENT