Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Place map example doesn't work fine!
Forum Updated to NodeBB v4.3 + New Features

Place map example doesn't work fine!

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
12 Posts 4 Posters 3.2k Views 1 Watching
  • 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 Offline
    M Offline
    mbnoimi
    wrote on last edited by
    #3

    @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
    0
    • S Offline
      S Offline
      Schluchti
      wrote on last edited by
      #4

      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
      0
      • S Schluchti

        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

        M Offline
        M Offline
        mbnoimi
        wrote on last edited by mbnoimi
        #5

        @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
        0
        • L Offline
          L Offline
          ldanzinger
          wrote on last edited by
          #6

          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
          0
          • L ldanzinger

            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 Offline
            M Offline
            mbnoimi
            wrote on last edited by
            #7

            @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
            0
            • L Offline
              L Offline
              ldanzinger
              wrote on last edited by
              #8

              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
              0
              • L ldanzinger

                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 Offline
                M Offline
                mbnoimi
                wrote on last edited by
                #9

                @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
                1
                • M mbnoimi

                  @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 Offline
                  H Offline
                  huynhthaihoa
                  wrote on last edited by huynhthaihoa
                  #10

                  @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
                  0
                  • H 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 Offline
                    M Offline
                    mbnoimi
                    wrote on last edited by
                    #11

                    @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
                    1
                    • M Offline
                      M Offline
                      mbnoimi
                      wrote on last edited by
                      #12

                      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
                      1

                      • Login

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