hi, i am trying to switch between basemaps when i am offline like topo and satellite, currently i have created mmpk file of satellite view and called it when map loaded initially, but how to switch between. maps when a person is offline.
Thanks in advance.
I m trying like this, but failed to succeed.
property string mapPackageFileName: "test map package.mmpk"
property string mapPackageFileNameTopo: "topo_map_test.mmpk"
MobileMapPackage {
id: mmpk
path: assetsPath + mapPackageFileName
onLoadStatusChanged: {
if (loadStatus !== Enums.LoadStatusLoaded) {
return;
}
if (mmpk.maps.length < 1) {
return;
}
mapView.map = mmpk.maps[0];
mapView.map.initialViewpoint = viewpoint;
}
onErrorChanged: {
console.log("Mobile Map Package Error: %1 %2".arg(error.message).arg(error.additionalMessage));
}
}
MobileMapPackage {
id: mmpktopo
path: assetsPath + mapPackageFileNameTopo
onLoadStatusChanged: {
if (loadStatus !== Enums.LoadStatusLoaded) {
return;
}
if (mmpktopo.maps.length < 1) {
return;
}
mapView.map = mmpktopo.maps[0];
}
onErrorChanged: {
console.log("Mobile Map Package Error: %1 %2".arg(error.message).arg(error.additionalMessage));
}
}
//Choose offline Basemap
function chooseOfflineMap(baseType){
if(baseType==='sat'){
mapView.map = mmpk.maps[0];
}else if(baseType==='topo'){
mapView.map = mmpktopo.maps[0];
}
}
Row{
anchors.horizontalCenter: parent.horizontalCenter
Layout.alignment: Qt.AlignHCenter
spacing:3
leftPadding: 80
topPadding: 15
Column{
visible: false
id:satclm
Controls.Kbutton {
id: satellitebtn
width: 100
text: qsTr("SATELLITE")
font.weight: Font.Bold
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 100
borderColor: "#ff7919"
font.pixelSize: 14
Layout.preferredHeight: 40
baseColor: "#FF7919"
textColor: "#FFFFFF"
//visible: false
onClicked: {
chooseOfflineMap('sat');
}//End onclick
}//End control
}//Endcolumn
Column{
visible: false
id:topoclm
Controls.Kbutton {
id: topobtn
width: 88
text: qsTr("TOPO")
font.weight: Font.Bold
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 100
borderColor: "#ffffff"
font.pixelSize: 14
Layout.preferredHeight: 40
baseColor: "#ffffff"
textColor: "#333333"
onClicked: {
chooseOfflineMap('topo');
}//End onclicked
}//end button
}//end column
}//End row
hello @ErwinSoekianto
can u please help me in this minor task
i m still stucked in it