Skip to content

Latest commit

 

History

History
111 lines (78 loc) · 12 KB

File metadata and controls

111 lines (78 loc) · 12 KB

Gap Analysis

This document identifies missing components required for geo-alignment in a user agent.

W3C Interfaces

Geo-alignment is defined by location and orientation with respect to the Earth's axes: east, north and up. These data can be accessed via the following interfaces already proposed in W3C:

W3C Document Current Status Interface
Geolocation API Proposed Recommendation Geolocation interface and callbacks
Orientation Sensor Working Draft OrientationSensor interface
Permissions Working Draft Permissions interface
Generic Sensor API Candidate Recommendation Draft Sensor
SensorErrorEvent
DeviceOrientation Event Working Draft DeviceOrientationEvent

W3C Devices and Sensors (DAS) Working Group published a roadmap giving a useful overview of W3C sensor document status including motion sensors.

Web Platform Tests

Web Platform Test results snapshot on 13 June 2022 - latest results available via link in Path column. MDN results also include mobile browsers.

Path Chrome Edge Firefox Safari MDN Results
geolocation-API 43 / 67 44 / 67 31 / 67 31 / 67 Geolocation API
orientation-sensor 121 / 123 73 / 123 16 / 123 16 / 123 OrientationSensor
RelativeOrientationSensor
AbsoluteOrientationSensor
permissions 119 / 125 120 / 125 82 / 125 79 / 125 Permissions API
generic-sensor 49 / 49 49 / 49 5 / 49 5 / 49 Sensor API
orientation-event 140 / 144 108 / 144 77 / 144 23 / 144 DeviceOrientation
deviceorientation
deviceorientationabsolute

Key Issues

Several key issues have been identified:

  1. Agnostic interface
    Geo-alignment is a high-level sensor interface which should be agnostic of the underlying low-level sensors since position and orientation can be calculated by many different means. Position can be determined from visual, inertial or satellite navigation data and this is reflected in the Geolocation API. Orientation should be handled in a similar way.

  2. Capability
    Geo-alignment can be determined only if three elements are present and correct:

    1. User agent support in the chosen web client. If this is not supported, sensor information cannot be accessed by the browser to calculate position and/or orientation.

    2. User permission to access sensors obtained through Permissions. If this is not supported or not allowed, accessing sensor information could pose a security risk to the user since location is personal information and the data privacy rights of web users should be properly respected.

    3. Suitable sensors to provide position and orientation data. If less than the required number of sensors are available, geo-alignment calculations may be less accurate or completely impossible.

  3. Accuracy
    Correct assessment of geo-alignment accuracy is critical since identified use cases require sufficient precision to yield a successful result. For example, Augmented Reality (AR) use cases need high accuracy geo-alignment to correctly overlay virtual assets on a video stream. Mobile devices may lack this accuracy and sufficient information should be provided in the API to determine the quality of geo-alignment available to the user agent so best use can be made of the available data.

  4. Privacy & security
    Data from accelerometer, magnetometer and gyroscope sensors could be combined using inertial navigation techniques to track a user's movements from a known location such as that of a Wifi or Bluetooth device so proper security permissions should be enforced. Privacy and security issues are discussed in the DeviceOrientation Event and Generic Sensor documents.

  5. Prototype evaluation
    Experimental features proposed for the DeviceOrientationEvent interface include webkitCompassHeading and webkitCompassAccuracy. Such prototypes should be evaluated with a view to inclusion in any proposed geo-alignment interface.

Gap Analysis

Several omissions for geo-alignment have been identified in the current W3C APIs:

  1. Data accuracy
    Data accuracy is quantified for position by accuracy and altitudeAccuracy attributes in the Geolocation interface. No accuracy metrics are available in the OrientationSensor interface so geo-alignment accuracy cannot be determined.

  2. Geo-alignment permission
    Standardised permissions in the Permissions Registry include geolocation to allow position data access. No entry exists to request permission for orientation (or individual sensors such as accelerometer, magnetometer and gyroscope) in the provisional permissions. Proper consideration should be given to whether orientation (or motion) is a powerful feature with and without geolocation.

  3. Required permission
    The DeviceOrientationEvent interface requires no permissions prior to accessing device orientation details despite a RequestPermission method in the interface. This is also inconsistent with the OrientationSensor model which is a policy-controlled feature requiring permissions.

  4. Permission Registry
    No entries for camera and microphone exist in the provisional permissions though both are implemented in Chrome (v64 onwards) and this should be updated.

  5. Device capability
    Geo-alignment is a high-level interface which relies on fusion of data from multiple sensors. No high-level permission exists to request orientation sensor access which is inconsistent with the high-level interface to geolocation.

  6. LiDAR support
    No W3C interface documentation has been found for LiDAR (light detection and ranging) which is already included as standard in some high-end tablets and can be used to improve geo-alignment accuracy. AbsoluteOrientationSensor and RelativeOrientationSensor could benefit from such support.

  7. Geo-aligned orientation
    Orientation sensor interface does not indicate whether or not orientation is geo-aligned. This is inconsistent with the DeviceOrientationEvent interface which includes the absolute attribute to indicate geo-alignment.

  8. Yaw, pitch and roll angles
    Orientation sensor interface does not include yaw, pitch and roll angles which represent rotations about the up, left and front axes respectively of an object. See w3c/orientation-sensor#43

  9. Sensor options
    The OrientationSensor interface includes the SensorOptions attribute to control sampling frequency. No such options are provided by DeviceOrientationEvent interface which updates on orientation change events rather than at a given frequency and this is inconsistent.

  10. Event support
    Few implementations of the DeviceOrientationEvent interface support geo-alignment since only Chrome (v102) currently implements the deviceorientationabsolute event. Support for this event must be explicitly checked as no error is (correctly) reported by addEventListener and no events are generated if the user agent does not support this feature which is a pitfall for developers.

  11. Missing sensors
    The DeviceOrientationEvent interface has no explicit way of reporting that a web device lacks the required sensors to generate geo-aligned orientation data. Either no events are generated as there are no valid data, or events are generated with null data.

Convenience API

An alternative access model for video capture is proposed by WebRTC with implicit camera and microphone permission requests using MediaDevices.getUserMedia. This may serve as a useful template for a convenience API for geo-alignment.