Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Place map example doesn't work fine!

    Mobile and Embedded
    4
    12
    2610
    Loading More Posts
    • 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.
    • M
      mbnoimi last edited by mbnoimi

      Hi,

      Whenever I run Places map example I get this error message .

      MapQuest has been discontinued

      How can I replace MapQuest service with something work?!

      BTW, I tried to pull this thread up but unfortunately I didn't get a suitable response on it :(

      1 Reply Last reply Reply Quote 0
      • S
        Schluchti last edited by

        Does it need to be OSM as map provider? Otherwise you could use mapbox, which works pretty well.

        Want to read more about Qt?

        https://gympulsr.com/blog/qt/

        Latest Article: https://gympulsr.com/blog/qt/2017/06/14/ios-background-music-qt.html

        1 Reply Last reply Reply Quote 0
        • M
          mbnoimi last edited by

          @Schluchti said in Place map example doesn't work fine!:

          Does it need to be OSM as map provider? Otherwise you could use mapbox, which works pretty well.

          How can I do it?

          1 Reply Last reply Reply Quote 0
          • S
            Schluchti last edited by

            You have to sign up at mapbox to get an API key. Then change your plugin key to "mapbox" and provide the mapbox Map ID and mapbox Access Token.

            see http://doc.qt.io/qt-5/location-plugin-mapbox.html

            Want to read more about Qt?

            https://gympulsr.com/blog/qt/

            Latest Article: https://gympulsr.com/blog/qt/2017/06/14/ios-background-music-qt.html

            M 1 Reply Last reply Reply Quote 0
            • M
              mbnoimi @Schluchti last edited by mbnoimi

              @Schluchti Thanks

              I tried to modify the example depending on MapBox requesremtns but unfortunately I get this error message:

              qml: Plugin Error (mapbox): The service provider does not support the QPlaceManager type.
              

              places_map.qml

              //! [Imports]
              import QtQuick 2.0
              import QtPositioning 5.5
              import QtLocation 5.6
              //! [Imports]
              
              Rectangle {
                  width: 360
                  height: 640
              
                  //! [Initialize Plugin]
                  Plugin {
                      id: myPlugin
                      name: "mapbox"
                      PluginParameter {
                          name: "mapbox.access_token"; value: "pk.eyJ1IjoibWJub2ltaSIsImEiOiJjaXZjYmY2Z2QwMDZhMnl5NGdwIn0.bCTFiaCGUDthspXPQKqi-A"
                      }
                      PluginParameter {
                          name: "mapbox.map_id"; value: "mbnoimi.handle"
                      }
                  }
                  //! [Initialize Plugin]
              
                  //! [Current Location]
                  PositionSource {
                      id: positionSource
                      property variant lastSearchPosition: locationOslo
                      active: true
                      updateInterval: 120000 // 2 mins
                      onPositionChanged:  {
                          var currentPosition = positionSource.position.coordinate
                          map.center = currentPosition
                          var distance = currentPosition.distanceTo(lastSearchPosition)
                          if (distance > 500) {
                              // 500m from last performed pizza search
                              lastSearchPosition = currentPosition
                              searchModel.searchArea = QtPositioning.circle(currentPosition)
                              searchModel.update()
                          }
                      }
                  }
                  //! [Current Location]
              
                  //! [PlaceSearchModel]
                  property variant locationOslo: QtPositioning.coordinate( 59.93, 10.76)
              
                  PlaceSearchModel {
                      id: searchModel
              
                      plugin: myPlugin
              
                      searchTerm: "Pizza"
                      searchArea: QtPositioning.circle(locationOslo)
              
                      Component.onCompleted: update()
                  }
                  //! [PlaceSearchModel]
              
                  //! [Places MapItemView]
                  Map {
                      id: map
                      anchors.fill: parent
                      plugin: myPlugin;
                      center: locationOslo
                      zoomLevel: 13
              
                      MapItemView {
                          model: searchModel
                          delegate: MapQuickItem {
                              coordinate: place.location.coordinate
              
                              anchorPoint.x: image.width * 0.5
                              anchorPoint.y: image.height
              
                              sourceItem: Column {
                                  Image { id: image; source: "marker.png" }
                                  Text { text: title; font.bold: true }
                              }
                          }
                      }
                  }
                  //! [Places MapItemView]
              
                  Connections {
                      target: searchModel
                      onStatusChanged: {
                          if (searchModel.status == PlaceSearchModel.Error)
                              console.log(searchModel.errorString());
                      }
                  }
              }
              
              1 Reply Last reply Reply Quote 0
              • L
                ldanzinger last edited by

                This discusses why it doesn't work any longer - https://forum.qt.io/topic/69190/openstreetmap-finish-to-work-any-alternatives/5

                It has been this way since July of 2016.

                M 1 Reply Last reply Reply Quote 0
                • M
                  mbnoimi @ldanzinger last edited by

                  @ldanzinger said in Place map example doesn't work fine!:

                  This discusses why it doesn't work any longer - https://forum.qt.io/topic/69190/openstreetmap-finish-to-work-any-alternatives/5

                  It has been this way since July of 2016.

                  I already know that. My problem with MapBox itself which suppose to be the valid alternative to OSM plugin

                  1 Reply Last reply Reply Quote 0
                  • L
                    ldanzinger last edited by

                    The documentation does not mention support for place searching (which your example code uses) - http://doc.qt.io/qt-5/location-plugin-mapbox.html

                    Are you needing to perform place searching, or just map viewing?

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      mbnoimi @ldanzinger last edited by

                      @ldanzinger said in Place map example doesn't work fine!:

                      Are you needing to perform place searching, or just map viewing?

                      I need place searching

                      H 1 Reply Last reply Reply Quote 1
                      • H
                        huynhthaihoa @mbnoimi last edited by huynhthaihoa

                        @mbnoimi : I get a same problem with you. Have you solved it yet ? If yes, can you give me a solution ?, thank you so much.

                        M 1 Reply Last reply Reply Quote 0
                        • M
                          mbnoimi @huynhthaihoa last edited by

                          @huynhthaihoa said in Place map example doesn't work fine!:

                          @mbnoimi : I get a same problem with you. Have you solved it yet ? If yes, can you give me a solution ?, thank you so much.

                          Unfortunately I couldn't find any solution until now although I posted this issue since a while!

                          1 Reply Last reply Reply Quote 1
                          • M
                            mbnoimi last edited by

                            I filed a bug report about this bug , Meanwhile I wish to get some help from Qt gurus because Qt location doesn't useful without accessing a stored places!

                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post