Repository navigation
Thoughts on maplibre-compose:location API #1137
westnordost
started this conversation in
General
Replies: 2 comments 5 replies
|
When using the val rotation =
// is nullable (why though?)
orientation
// the actual orientation is in `orientation` because `Orientation` includes also `timeMark`
?.orientation
// no, actually the actual orientation is in `value`, because `BearingWithAccuracy` also includes `accuracy`
?.value
// but it is just a `Bearing`, to get a rotation, one must specify relative to which other `Bearing` one seeks
?.clockwiseRotationTo(Bearing.North)
// but a rotation is unit agnostic, so one has to specify the `RotationUnit` to get the actual double value
// however, it's not `RotationUnit.Degrees` but `DMS.Degrees` which makes it hard to find since there is also
// `World.Degrees` which is something else
?.toDouble(DMS.Degrees) But maybe I am awfully late to make that remark. I never really was on board with this, because we have one standard unit of length, meters, and one standard unit of bearing/rotation (in context of geography), degrees. (Well, maybe radians sometimes, but that can just be documented!). But I feel the decision to fully unit-ify spatial-k and hence any libraries that depend on it lies well in the past. |
2 replies
|
#1145 should resolve the stuff here, lmk what you think val rotation = rememberHeadingProvider()
.updates()
.map { (it.bearing - North).inDegrees }
.collectAsState(null)
// or
val heading = rememberHeadingProvider()
.updates()
.collectAsState(null)
val rotation = heading?.let { (it.bearing - North).inDegrees } |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I am posting this as a discussion because not sure if this is deliberate each.
Slight inconsistency in
LocationLocationhasaltitudeAccuracy: Length?andpositionWithAccuracy: PositionWithAccuracywhich includes aPositionPositionhasaltitude: Double?I.e.:
altitudeandaltitudeAccuracyare defined at different points with inconsistent units.OrientationProvider API inconsistency
The interface is
where each implementation requires to specify an update interval in the constructor as well as a coroutine scope and a SharingStarted. It seems to be somewhat inconsistent with the interface of
LocationProviderUnless this is due to technical constraints, it would seem more consistent and more flexible to redefine the interface like this:
Unkown whether location services are active outside of location request
So, before making a
LocationProvider::updates(...)call, it is possible to check (and observe) the current state of the location permissions.It is also possible to check the
LocationBackendAvailability, which apparently never changes during the app runtime which is why it is not aStateFlow.What seems to be missing is to observe the current state of location services (on or off).
All reactions