How to get the detailed street name of current location?

76 Views Asked by At

By following the examples on https://bixbydevelopers.com/dev/docs/dev-guide/developers/library.geo I can get a viv.geo.GeoPoint, but it contains only longitude and latitude, how do I get more detailed info such as street name?

    input (myPoint) {
      type (geo.GeoPoint)
      min (Required) max (One)
      default-init {
        intent {
          goal: geo.GeoPoint
          route: geo.CurrentLocation
        }
      }
    }

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

There are two ways:

  1. If only wants to render the details, one can use library default value dialog, although debugger is not showing the reverseGeo property, it will be displayed correctly. Consider this simple result-view:
result-view {
  match: MyGeoPoint(this) 
  message: template ("I am at [#{value(this)}]")
}

Here is the simulator result enter image description here

  1. reverseGeo is a lazy-sourced property of viv.geo.GeoPoint, the following code is an example of how to access it. For more on this topic one can click here
action (GetMyPoint) {
  description (debug for current GPS location)
  type (Search)
  collect {
    input (myPoint) {
      type (geo.GeoPoint)
      min (Required) max (One)
      default-init {
        intent {
          goal: geo.GeoPoint
          route: geo.CurrentLocation
        }
      }
    }
    computed-input (address) {
      type (geo.Address) 
      min (Required) max (One)
      compute {
        intent {
          goal: geo.Address
          value: $expr(myPoint.reverseGeo)
        }
      }
    }
  }
  output (MyGeoPoint) {
    evaluate {
      $expr(myPoint)
    }
  }
}

Now reverseGeo is showing on debugger enter image description here