bixby - 如何获取当前位置的详细街道名称?
问题描述
通过遵循https://bixbydevelopers.com/dev/docs/dev-guide/developers/library.geo上的示例,我可以获得 viv.geo.GeoPoint,但它只包含经度和纬度,我如何获得更详细街道名称等信息?
input (myPoint) {
type (geo.GeoPoint)
min (Required) max (One)
default-init {
intent {
goal: geo.GeoPoint
route: geo.CurrentLocation
}
}
}
解决方案
有两种方法:
- 如果只想渲染细节,可以使用库默认值对话框,虽然调试器没有显示 reverseGeo 属性,但它会正确显示。考虑这个简单的结果视图:
result-view {
match: MyGeoPoint(this)
message: template ("I am at [#{value(this)}]")
}
- reverseGeo 是 viv.geo.GeoPoint 的惰性资源属性,以下代码是如何访问它的示例。有关此主题的更多信息,请单击此处
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)
}
}
}
推荐阅读
- php - Laravel - 检查关系是否存在
- elasticsearch - 由于 Elasticsearch 集群运行状况黄色导致的部分查询结果
- r - 如何将一个df的列中的每个值与R中另一个df的列中的每个值进行比较?具有不同行号的dfs
- json - 错误:不能将参数类型“int”分配给参数类型“String”
- sql-server - 为什么使用增量变量更新会创建重复值?
- ios - 在主 StackView 中嵌入的 ScrollView 中嵌入 StackView
- html - 如何让输入字段与文本区域并排放置,而不是重叠?
- pdf - 无法在 Intellij IDEA 中查看 pdf
- jdbc - IIB 没有找到 jdbc 驱动程序
- python - 如何从继承类的方法扩展列表