AnsweredAssumed Answered

Change Basemap with button

Question asked by jay.kapalczynski on Aug 16, 2019
Latest reply on Aug 20, 2019 by jay.kapalczynski

Simply trying to change the basemap with a click of a button any it does not seem to be working....any thoughts?

 

 

import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Controls 1.0
import QtQuick 2.9
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import Esri.ArcGISRuntime 100.5
import QtQuick.Layouts 1.1

Item {

    signal previous(string message)
    property string basemapId: "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"

    MapView {
        id:mapView
        Layout.fillHeight: true
        Layout.alignment: Qt.AlignTop
        width: parent.width
        height: parent.height
        property real initialMapRotation: 0

        Map {
            id: map
            Basemap {
                id: basemaplocation
                ArcGISTiledLayer {
                    id: baseMap
                    url: basemapId
                    visible: true
                }
            }
        }
    }


    Row {
        anchors {
            bottom: parent.bottom
            left: parent.left
            right: parent.right
            margins: 5 * scaleFactor
            bottomMargin: 50 * scaleFactor
        }
        spacing: 5
        Button {
            text: "Switch Basemap"
            onClicked: {
                console.log("changing basemamp");
                basemapId = "http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer"
                baseMap.load(basemapId);
            }
        }
    }

}

Outcomes