AnsweredAssumed Answered

Change TPK loaded

Question asked by jay.kapalczynski on Sep 9, 2019
Latest reply on Sep 23, 2019 by jay.kapalczynski

Can you change the TPK that was initially loaded in your app

 

// SNIP

Item {
    id: mmpkManager

    property string itemName2: "backgrounddatatpk.tpk"
    property string filePath: [fileFolder2.path, itemName2].join("/")


    property string itemName3: "backgrounddatatpk.tpk"
    property url fileUrl3: [fileFolder3.url, itemName3].join("/")



    // THIS IS FOR THE PATHING TO THE TOPOS ASKED FOR IN THE LoadService.qml
    FileFolder {
        id: fileFolder2

        //USE THIS WHEN USING PLAYER ON THE DESKTOP
        //property string exLocation:AppFramework.userHomeFolder.filePath("ArcGIS/AppStudio/Data/QuickReport")

        path: exLocation
        Component.onCompleted: {

            console.log("exLocation: " + exLocation)
        }
    }


    FileFolder {
        id: fileFolder3

        //USE THIS WHEN USING PLAYER ON THE DESKTOP
        property string exLocation:AppFramework.userHomeFolder.filePath("ArcGIS/AppStudio/Data/QuickReport")

        url: exLocation3
        Component.onCompleted: {

            console.log("exLocation 3 : " + exLocation3)
        }
    }

}

 

   //SNIP

    property string dataPath:  app.mmpkManager.filePath

    property string dataURL3:  app.mmpkManager.fileUrl3

        MapView{
            id: mapView

            Map{
                id: map

                Basemap {
                    ArcGISTiledLayer {
                       url: dataPath
                    }
                }
      // SNIP






Button {
     id: offlineSwitchButton
     visible: true
     text: "change basemap"

    var location = JSON.stringify({url: dataURL3});

    onClicked: {
         var mapping = ArcGISRuntimeEnvironment.createObject("Basemap", location);
         mapView.map = mapping;
    }
}

Outcomes