AnsweredAssumed Answered

Offline Mapping

Question asked by aneeqa.abrar on Nov 13, 2017
Latest reply on Nov 14, 2017 by Jayson_Ward-esristaff

How can I switch between online and offline map? So my workflow is: the map loads if ocnnected to internet and the tpk loads if internet not connected. 

The code below gives me an online map and it should give me an offline map but its not. Can someone point me in the right direction?


//Offline Mapping

property string dataPath: AppFramework.userHomeFolder.filePath("ArcGIS/AppStudio/Data")
property string inputdata: "Rheinauen.tpk"
property string outputdata: dataPath + "/" + inputdata

function copyLocalData(input, output) {
var resourceFolder = AppFramework.fileFolder(app.folder.folder("data").path);
resourceFolder.copyFile(input, output);
return output

// Create MapView that contains a Map with the Basemap
    MapView {
        id: mapView
        width: parent.width
        height: setInitialMapArea.height - balken_menu.height
        focus: true
        rotationByPinchingEnabled: false
        zoomByPinchingEnabled: true
        Map {
            id: map
            minScale: 100000
            maxScale: 5000
            BasemapTopographic {}
            // Add a tiled layer as an operational layer
            ArcGISTiledLayer {
                id: tiledLayer
                url: ""
            initialViewpoint: viewpoint
//            Basemap {
                ArcGISTiledLayer {
                    TileCache {
                        id: offlinemap
                        path: AppFramework.resolvedPathUrl(copyLocalData(inputdata, outputdata))