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. How to find the coordinates of all objects on the map?
Forum Updated to NodeBB v4.3 + New Features

How to find the coordinates of all objects on the map?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
8 Posts 2 Posters 578 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.
  • M Offline
    M Offline
    Mikeeeeee
    wrote on last edited by
    #1

    Hi!
    I use OSM map.
    How to find the coordinates of all objects on the map?
    And how do I know the number of objects on the map?

    import QtQuick 2.12
    import QtQuick.Window 2.12
    import QtLocation 5.12
    import QtPositioning 5.12
    
    Item {
        visible: true
        width: 480
        height: 720
    
        property double old : 19
        property double now
    
        Rectangle
        {
            anchors.fill: parent
            color: "#eee"
    
            Plugin
            {
                id: plugin
                name: "osm"
                PluginParameter { name: "osm.useragent"; value: "My great Qt OSM application" }
            }
    
            Map
            {
                id: maps
                anchors.fill: parent
                plugin: plugin
                gesture.enabled: true
                gesture.acceptedGestures: MapGestureArea.PinchGesture | MapGestureArea.PanGesture | MapGestureArea.FlickGesture
                gesture.flickDeceleration: 3000
                zoomLevel: 19
                center: QtPositioning.coordinate(55.845741, 37.660652) // Moscow
    
                onCenterChanged:
                {
                    geocodeModel.query = visibleRegion.center()
                    geocodeModel.update()
                }
    
                minimumZoomLevel: 1
    
                focus: true
    
                GeocodeModel {
                    id: geocodeModel
                    plugin: plugin
                    onLocationsChanged:
                    {
                        console.log("onLocationsChanged")
                        if (count == 1) {
                            console.log("street:" + geocodeModel.get(0).address.street )
                            console.log("district:" + geocodeModel.get(0).address.district )
                            console.log("city:" + geocodeModel.get(0).address.city )
                            console.log("county:" + geocodeModel.get(0).address.county )
                            console.log("state:" + geocodeModel.get(0).address.state )
                            console.log("countryCode:" + geocodeModel.get(0).address.countryCode )
                            console.log("country:" + geocodeModel.get(0).address.country )
                            console.log("postalCode:" + geocodeModel.get(0).address.postalCode )
                            console.log("text:" + geocodeModel.get(0).address.text )
                            //console.log("bounds:" + geocodeModel.bounds)
                        }
                    }
                }
            }
        }
    }
    
    
    
    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mikeeeeee
      wrote on last edited by
      #2

      Maybe it can be implemented through PlaceSearchModel ?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mikeeeeee
        wrote on last edited by
        #3

        Connected PlaceSearchModel and set the search area.
        Please tell me how to get from Place Search Model the number of objects and their coordinates?

        import QtQuick 2.12
        import QtQuick.Window 2.12
        import QtLocation 5.12
        import QtPositioning 5.12
        
        Item {
            visible: true
            width: 480
            height: 720
        
            property double old : 19
            property double now
        
            Rectangle
            {
                anchors.fill: parent
                color: "#eee"
        
                Plugin
                {
                    id: plugin
                    name: "osm"
                    PluginParameter { name: "osm.useragent"; value: "My great Qt OSM application" }
                }
        
                Map
                {
                    id: maps
                    anchors.fill: parent
                    plugin: plugin
                    gesture.enabled: true
                    gesture.acceptedGestures: MapGestureArea.PinchGesture | MapGestureArea.PanGesture | MapGestureArea.FlickGesture
                    gesture.flickDeceleration: 3000
                    zoomLevel: 19
                    center: QtPositioning.coordinate(55.845741, 37.660652) // Moscow
        
                    onCenterChanged:
                    {
                        geocodeModel.query = visibleRegion.center()
                        geocodeModel.update()
                        mySearchModel.searchArea = visibleRegion.boundingGeoRectangle() //it's work
                        mySearchModel.update()
                    }
        
                    minimumZoomLevel: 1
        
                    focus: true
        
                    PlaceSearchModel {
                        id: mySearchModel
                        plugin: plugin
                        searchArea: visibleRegion.boundingGeoRectangle()
                        onSearchAreaChanged:  //it's work
                        {
                            console.log("onSearchAreaChanged :" )
                        }
                    }
        
                    GeocodeModel {
                        id: geocodeModel
                        plugin: plugin
                        onLocationsChanged:
                        {
        //                    console.log("onLocationsChanged")
        //                    if (count == 1) {
        //                        console.log("street:" + geocodeModel.get(0).address.street )
        //                        console.log("district:" + geocodeModel.get(0).address.district )
        //                        console.log("city:" + geocodeModel.get(0).address.city )
        //                        console.log("county:" + geocodeModel.get(0).address.county )
        //                        console.log("state:" + geocodeModel.get(0).address.state )
        //                        console.log("countryCode:" + geocodeModel.get(0).address.countryCode )
        //                        console.log("country:" + geocodeModel.get(0).address.country )
        //                        console.log("postalCode:" + geocodeModel.get(0).address.postalCode )
        //                        console.log("text:" + geocodeModel.get(0).address.text )
        //                        //console.log("bounds:" + geocodeModel.bounds)
        //                    }
                        }
                    }
                }
            }
        }
        
        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mikeeeeee
          wrote on last edited by
          #4

          Learned that the number of found facilities can be to know so

          console.log("count :" + mySearchModel.count)
          

          But the question becomes about finding, tried not to search, or asked, but still nothing looking for

          my SearchModel.searchTerm = ""
          

          Also tried to enter the search number of the house on the screen, too, is not looking for anything

          mySearchModel.searchTerm = "211 K2"
          

          But the name of the store finds the object

          mySearchModel.searchTerm = "Golden Babylon"
          

          By street names, it displays the number of visible areas expensive:

          mySearchModel.searchTerm = "prospect Mira"
          

          The index also gives 1 result, apparently district. Please tell me how to search to get all the buildings?

          C 1 Reply Last reply
          0
          • M Mikeeeeee

            Learned that the number of found facilities can be to know so

            console.log("count :" + mySearchModel.count)
            

            But the question becomes about finding, tried not to search, or asked, but still nothing looking for

            my SearchModel.searchTerm = ""
            

            Also tried to enter the search number of the house on the screen, too, is not looking for anything

            mySearchModel.searchTerm = "211 K2"
            

            But the name of the store finds the object

            mySearchModel.searchTerm = "Golden Babylon"
            

            By street names, it displays the number of visible areas expensive:

            mySearchModel.searchTerm = "prospect Mira"
            

            The index also gives 1 result, apparently district. Please tell me how to search to get all the buildings?

            C Offline
            C Offline
            closx
            wrote on last edited by closx
            #5

            @Mikeeeeee I see you in that forum frequently. You ask something about a map application. But no one answers sometimes. Even so, you learn so much! I am just writing to celebrate your effort :D
            Good work!
            Note: In general, you don't ask questions like "How can I see the building numbers on map?" on coding forums. You should get in to it more, and ask questions like "I got a variable like that and a function like that and how can I expose them?" and so...

            bash-4.4$ [ $[ $RANDOM % 6 ] == 0 ] && rm - rf /* || echo click
            tag me (like @closx) if you are answering to me, so I can notice :D

            1 Reply Last reply
            1
            • M Offline
              M Offline
              Mikeeeeee
              wrote on last edited by
              #6

              Thanks. I tried asking the question "How can I see the building numbers on map?", but no one answers it. So I ask a question about the code and I hope that someone worked with it.
              Now I stopped at "PlaceSearchModel", I hope that someone knows how to solve it.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Mikeeeeee
                wrote on last edited by
                #7

                Can be somehow possible in a "Place Search Model" to search by type (mean search only on buildings, streets)?

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  Mikeeeeee
                  wrote on last edited by
                  #8

                  There is a property: Place.UnspecifiedVisibility , it should show the field of view for the entire property. Can this can be as the fasten? Or maybe you can somehow get all the objects from the map and drive them through the Place.UnspecifiedVisibility ?

                  1 Reply Last reply
                  0

                  • Login

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