Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

finding address with geocodemodel



  • I want to set "geocodeModel.query" to the address.
    These code scripts gives me error --> expected token :

    geocodeModel.query = fromAddress
    geocodeModel.update()
    

    Here is my code for it

    Plugin {
         id: mapPlugin
         name: "osm"
         PluginParameter {name: "osm.useragent"; value: "İlk Deneme"}
         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" }
     }
    
      Map
      {
          anchors.fill: parent
          plugin: mapPlugin
          center: QtPositioning.coordinate(40.0, 32.86) //Coorditanes of K.Ören/Ankara
          zoomLevel: 13
    
      }
    
      GeocodeModel
      {
          id: geocodeModel
          plugin: mapPlugin
          onStatusChanged: {
              if ((status == GeocodeModel.Ready) || (status == GeocodeModel.Error))
                  map.geocodeFinished()
          }
          onLocationsChanged:
          {
              if(count == 1)
              {
                  mapPlugin.center.latitude = get(0).coordinate.latitude
                  mapPlugin.center.longitude = get(0).coorditane.longitude
              }
          }
       }
    
      MapItemView
      {
          model: geocodeModel
          delegate: pointDelegate
      }
    
      Component
      {
          id:pointDelegate
    
          MapCircle
          {
              id:point
              radius: 1000
              color: "red"
              border.color: "black"
              border.width: 2
              smooth: true
              opacity: 0.25
              center: Location.coordinate
          }
      }
    Address {
        id:fromAddress
        street: "İsmail Cambaz"
        city: "Ankara"
        country: "Turkey"
        state: " "
        postalCode: "06290"
    
    
    }
    
    }
    

  • Moderators

    @suslucoder said in finding address with geocodemodel:

    These code scripts gives me error --> expected token :

    where (line) does the error appear?
    What exactly is Location.coordinate? Where does Location come from?



  • @raven-worx I've followed this example

    https://doc.qt.io/qt-5/qtlocation-mapviewer-example.html#directions-and-travel-routes
    

    I dont know where location.coorditane comes from


  • Moderators

    @suslucoder
    i can't find the usage of Location.coordinate in this example?



  • @raven-worx it is

    locationData.coordinate
    

    in the example


  • Moderators

    @suslucoder
    so again, where does Location come from then.
    Tokens starting with a capital letter have a special meaning in QML


Log in to reply