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 get Address.text?
Forum Updated to NodeBB v4.3 + New Features

How to get Address.text?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
8 Posts 3 Posters 735 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!
    How to get Address.text?
    I need the coordinates and house numbers on the visible side of the map. Here is my code:

    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"
    
    
    
            PositionSource
            {
                id: src
    
            }
    
            Address
            {
             id:  address
            }
    
            Plugin
            {
                id: plugin
                name: "osm"
                PluginParameter { name: "osm.useragent"; value: "My great Qt OSM application" }
                PluginParameter { name: "osm.mapping.host"; value: "http://osm.tile.server.address/" }
                PluginParameter { name: "osm.mapping.copyright"; value: "All mine" }
                PluginParameter { name: "osm.routing.host"; value: "http://osrm.server.address/viaroute" }
                PluginParameter { name: "osm.geocoding.host"; value: "http://geocoding.server.address" }
                PluginParameter { name: "osm.places.host"; value: "http://geocoding.server.address" }
            }
    
            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(59.91, 10.75) // Oslo
    
                onZoomLevelChanged:
                {
                    console.log("onZoomLevelChanged:")
                    console.log("coordinate ctnter:" + visibleRegion.center())
                    console.log("coordinate geoshape:" + visibleRegion.boundingGeoRectangle())
                }
    
                onCenterChanged:
                {
                    console.log("onCenterChanged:")
                    console.log("coordinate ctnter:" + visibleRegion.center())
                    console.log("coordinate geoshape:" + visibleRegion.boundingGeoRectangle())
                    console.log("address:" )
                }
    
                minimumZoomLevel: 1
    
                focus: true
    
    
            }
        }
    }
    
    jsulmJ 1 Reply Last reply
    0
    • M Mikeeeeee

      Hi!
      How to get Address.text?
      I need the coordinates and house numbers on the visible side of the map. Here is my code:

      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"
      
      
      
              PositionSource
              {
                  id: src
      
              }
      
              Address
              {
               id:  address
              }
      
              Plugin
              {
                  id: plugin
                  name: "osm"
                  PluginParameter { name: "osm.useragent"; value: "My great Qt OSM application" }
                  PluginParameter { name: "osm.mapping.host"; value: "http://osm.tile.server.address/" }
                  PluginParameter { name: "osm.mapping.copyright"; value: "All mine" }
                  PluginParameter { name: "osm.routing.host"; value: "http://osrm.server.address/viaroute" }
                  PluginParameter { name: "osm.geocoding.host"; value: "http://geocoding.server.address" }
                  PluginParameter { name: "osm.places.host"; value: "http://geocoding.server.address" }
              }
      
              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(59.91, 10.75) // Oslo
      
                  onZoomLevelChanged:
                  {
                      console.log("onZoomLevelChanged:")
                      console.log("coordinate ctnter:" + visibleRegion.center())
                      console.log("coordinate geoshape:" + visibleRegion.boundingGeoRectangle())
                  }
      
                  onCenterChanged:
                  {
                      console.log("onCenterChanged:")
                      console.log("coordinate ctnter:" + visibleRegion.center())
                      console.log("coordinate geoshape:" + visibleRegion.boundingGeoRectangle())
                      console.log("address:" )
                  }
      
                  minimumZoomLevel: 1
      
                  focus: true
      
      
              }
          }
      }
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Mikeeeeee said in How to get Address.text?:

      How to get Address.text?

      I would say

      address.text
      

      or what do you mean?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

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

        I tried that, but nothing return.
        I need the house numbers and their coordinates on the visible side of the map.

        KroMignonK 1 Reply Last reply
        0
        • M Mikeeeeee

          I tried that, but nothing return.
          I need the house numbers and their coordinates on the visible side of the map.

          KroMignonK Offline
          KroMignonK Offline
          KroMignon
          wrote on last edited by
          #4

          @Mikeeeeee said in How to get Address.text?:

          I need the house numbers and their coordinates on the visible side of the map

          I never used QLocation/QPositioning, but I think you must first connect the Adress item with the Map. I don't know how you have to do it... But this seems to me to be the first step to do.
          I think you have to connect the Address.address property... but I don't really known :(

          It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

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

            I tried writing Address in the body of map, but it didn't help. Address has very few methods and they don't allow me to set coordinates and map.

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

              You can bind an address to a location, but it is not clear as to the location 4 enter the bounding coordinates.

                      Location
                      {
                          id: myLocation
                       /*coordinate{
                       latitude:  - 27.3
                       longitude:  153.1
                          }*/
                              address:  Address {
                              id:  myAddress2
                          }
                      }
              
              1 Reply Last reply
              0
              • M Offline
                M Offline
                Mikeeeeee
                wrote on last edited by
                #7

                It turned out the address can be obtained so, but there are no coordinates and house numbers. Do you know where the coordinates and house numbers might be?

                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(59.91, 10.75) // Oslo
                
                            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("postalCode:" + geocodeModel.get(0).address.text )
                                    }
                                }
                            }
                        }
                    }
                }
                
                
                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  Mikeeeeee
                  wrote on last edited by
                  #8

                  It turned out the house number is in text

                  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