I'm wondering if maybe some one can help me figure this out. How do I get the user's neighborhood (or city) from $user.currentLocation?
I've been trying various things, and looked at the docs, especially here: https://bixbydevelopers.com/dev/docs/dev-guide/developers/library.geo#searchregion-and-currentlocation But it's not quite what I'm looking for.
If the user says, "What's the weather?" without specifying the place, my getWeather action looks like this:
input (where) {
min (Optional) max(One)
type (viv.geo.NamedPoint)
default-select {
with-rule {
select-first
}
}
default-init {
if ($user.currentLocation.$exists) {
intent {
goal: geo.GeoPoint
value-set: geo.CurrentLocation { $expr ($user.currentLocation) }
}
}
}
This will give me the long/lat that I use for the weather API query. But I'd like to display (though not say) the neighborhood (or city) of the users current location in a view. (I believe if I change the goal/value-set to SearchRegion, then I can get the city, but not the long/lat of $user.currentLocation. Instead, I get a generic long/lat of the city, which isn't specific enough.)
So, I want 1) The long/lat of $user.currentLocation for the API and 2) the neighborhood (or city) of that long/lat for a view. I can't figure out how to get both.
The input you've defined is a
NamedPointandNamedPoint.pointis aGeoPointso it should have the lat/longs you need.To get the city, the
NamedPoint.addressshould contain anAddressstructure to access the Street address, city, state, country, etc.Another option might be the
reverseGeoproperty of aGeoPointto get the Address. This property is alazy-sourceso the data will not be available until this property is called.