How to change the map type of a simple QML map component?
-
Hi,
I am can see a map using QML Map object with QtLocation5.5. But not being able to generate different map types like satellite or hybrid.
Here is the code I tried.
Plugin { id: mapPlugin name: "here" PluginParameter { name: "here.app_id"; value: "****" } PluginParameter { name: "here.token"; value: "*****" } } Map{ id: hereMap anchors.fill: parent plugin: mapPlugin activeMapType:MapType.SatelliteMapDay }
-
Hi and welcome to devnet,
Did you check with supportedMapTypes that you have access to other map types ?
-
Thank you @SGaist ,
When I checked with supportedMApTypes, all i get is,
qml: 0: QDeclarativeGeoMapType(0x2707e70)
qml: 1: QDeclarativeGeoMapType(0x270d600)
qml: 2: QDeclarativeGeoMapType(0x2710400)
qml: 3: QDeclarativeGeoMapType(0x2713220)
qml: 4: QDeclarativeGeoMapType(0x2715e90)
qml: 5: QDeclarativeGeoMapType(0x2718cb0)
qml: 6: QDeclarativeGeoMapType(0x271b660)
qml: 7: QDeclarativeGeoMapType(0x2699bf0)
qml: 8: QDeclarativeGeoMapType(0x2dad4e0)
qml: 9: QDeclarativeGeoMapType(0x2db2270)
qml: 10: QDeclarativeGeoMapType(0x26c7070)
qml: 11: QDeclarativeGeoMapType(0x26cf060)
qml: 12: QDeclarativeGeoMapType(0x26cfa70)
qml: 13: QDeclarativeGeoMapType(0x26c6c20)
qml: 14: QDeclarativeGeoMapType(0x2dada50)
qml: 15: QDeclarativeGeoMapType(0x26da130)
qml: 16: QDeclarativeGeoMapType(0x26e43a0)
qml: 17: QDeclarativeGeoMapType(0x2db2810)
qml: 18: QDeclarativeGeoMapType(0x2db2900)
qml: 19: QDeclarativeGeoMapType(0x26e8450)
qml: 20: QDeclarativeGeoMapType(0x26f3ae0) -
@nmnandakishore You could have a try with the following snippets, to list the available map type
GroupBox{ title:"map types" ComboBox{ model:hereMap.supportedMapTypes textRole:"description" onCurrentIndexChanged: hereMap.activeMapType = hereMap.supportedMapTypes[currentIndex] } }
if this is doesn't work neither, have a try with OpenStreetMap plugin, using "osm" as name.
-
Thanks @Charby, It worked. :)
-
@nmnandakishore You are welcome.
By the way, you might be interested in viewing this post containing the materials used during my last meetup which was focus on QtLocation - you could find helpful tips for managing maps, point of interests and route.