Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to change the map type of a simple QML map component?
QtWS25 Last Chance

How to change the map type of a simple QML map component?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qtlocationmaphere mapsactivemaptypemaptype
6 Posts 3 Posters 6.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nmnandakishore
    wrote on last edited by
    #1

    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
    }
    
    CharbyC 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Did you check with supportedMapTypes that you have access to other map types ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      N 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Did you check with supportedMapTypes that you have access to other map types ?

        N Offline
        N Offline
        nmnandakishore
        wrote on last edited by
        #3

        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)

        1 Reply Last reply
        0
        • N nmnandakishore

          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
          }
          
          CharbyC Offline
          CharbyC Offline
          Charby
          wrote on last edited by
          #4

          @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.

          1 Reply Last reply
          3
          • N Offline
            N Offline
            nmnandakishore
            wrote on last edited by
            #5

            Thanks @Charby, It worked. :)

            CharbyC 1 Reply Last reply
            0
            • N nmnandakishore

              Thanks @Charby, It worked. :)

              CharbyC Offline
              CharbyC Offline
              Charby
              wrote on last edited by
              #6

              @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.

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved