[Geolocation] Expose 'Coordinates.heading' property
Reported by
ka.gema...@gmail.com,
Feb 27 2018
|
|||||
Issue descriptionSteps to reproduce the problem: Currently the position 'Coordinates.heading' is not exposed via the Geolocation API. In the meantime the heading can be calculated using the 'DeviceOrientationEvent.alpha' property adjusted with the device screen orientation, as demonstrated by that app https://lamplightdev.github.io/compass . What is the expected behavior? 'Coordinates.heading' property should be exposed additionally via the Geolocation API. What went wrong? Did this work before? N/A Does this work in other browsers? N/A Chrome version: 65 Channel: beta OS Version: Flash Version:
,
Feb 28 2018
,
Feb 28 2018
Tested the issue in Android and could not reproduce the issue. Steps Followed: 1. Launched Chrome. 2. Navigated to https://lamplightdev.github.io/compass 3. Did not observe such behaviour Chrome versions tested: 65.0.3325.85 OS: Android 7.0.0, 6.0.1 Android Devices: Samsung J7 and S7 @reporter: Could you please help us with the details of your device and also attach a screencast as well for better understanding of the issue. Thanks!!
,
Feb 28 2018
@sandeepkumars: This is not an issue but a feature request. Both geolocation and device orientation work correctly with Chrome, and with the app example. But currently the heading aka 'Coordinates.heading' is not exposed via the Geolocation API. To get the the heading, it requires to use the device Orientation API whereas it could also be retrieved via the Geolocation API as well, that way we wouldn't need to manage 2 APIs (as done in this app example) but we would get both position coordinates and position heading with one Geolocation API call. From the app: - Orientation: https://github.com/lamplightdev/compass/blob/gh-pages/js/app.js#L396 - Geolocation: https://github.com/lamplightdev/compass/blob/gh-pages/js/app.js#L415 Seems both API have their relevancy and address two different use cases, one for hyper-frequent polling (e.g. displaying a compass), the other for smoother polling (e.g. displaying a map with a 3 seconds interval).
,
Feb 28 2018
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Feb 28 2018
The |heading| attribute is exposed via the Geolocation API according to Coordinates.idl: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/geolocation/Coordinates.idl The Android implementation of the Geolocation service fills in the |heading| attribute when the Location it receives from the Android system returns true from hasBearing(). I am working on verifying that this attribute is populated by Android.
,
Feb 28 2018
Thank you. I've been working with the Geolocation API on Android for some times and have never seen the |heading| nor |altitude| - dunno if my device has some altimeter capability -, only |accuracy| (using an S3 and ZenFone 2).
,
Feb 28 2018
I just put together a demo for this and verified that I do sometimes get a heading: https://reillyeon.github.io/scraps/watch-position.html I think the issue is that the Android Geolocation API only provides a heading when it is sure that the device is moving in a direction (i.e. GPS-based heading) while the DeviceOrientation API will give out a heading from the compass no matter what. Marking this as WontFix since it seems to be working as intended.
,
Mar 1 2018
Well, ok then. I'd have expected that 'alpha' and 'heading' would be correlated/coupled. Not the best developer-experience and a bit of a pity that Geolocation attributes other than coordinates' are a bit of second-class attributes. For example, on the matter of 'heading', the Google Maps JS API doesn't provide an example with the Geolocation API but with a hard-coded value and a 3 seconds time-based rotation. That looks like Geolocation API is not really reliable for heading, though. Anyway, I can live with DeviceOrientation API to get the heading. Thank you for having investigated the issue. Cheers. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by dtapu...@chromium.org
, Feb 27 2018