# Magnetometer

## Editor’s Draft, 1 January 1970

This version:
  https://w3c.github.io/magnetometer/
Latest published version:
  https://www.w3.org/TR/magnetometer/
Previous Versions:
  https://www.w3.org/TR/2018/CR-magnetometer-20180320/
Version History:
  https://github.com/w3c/magnetometer/commits/master/index.bs
Feedback:
  public-device-apis@w3.org with subject line “`[magnetometer] … message topic …`” (archives)
Editors:
  Anssi Kostiainen (Intel Corporation)
  Rijubrata Bhaumik (Intel Corporation)
Bug Reports:
  via the w3c/magnetometer repository on GitHub
Test Suite:
  web-platform-tests on GitHub

Copyright © 1970 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark and permissive document license rules apply.

## Abstract

This specification defines a concrete sensor interface to measure magnetic field in the X, Y and Z axis.

## Status of this document

This is a public copy of the editors’ draft. It is provided for discussion only and may change at any moment. Its publication here does not imply endorsement of its contents by W3C. Don’t cite this document other than as work in progress.

If you wish to make comments regarding this document, please send them to public-device-apis@w3.org (subscribe, archives). When sending e-mail, please put the text “magnetometer” in the subject, preferably like this: “[magnetometer] …summary of comment…”. All comments are welcome.

This document was produced by the Devices and Sensors Working Group.

This document was produced by a group operating under the W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 1 March 2019 W3C Process Document.

## 1. Introduction

Magnetometer extends the Generic Sensor API [GENERIC-SENSOR] to provide information about the magnetic field as detected by the device’s primary magnetometer sensor. The magnetometer sensor measures the magnetic field for all three physical axes (x, y, z) in μT (micro Tesla).

This specification defines two new interfaces:

- `Magnetometer` that reports calibrated magnetic field values, and

- `UncalibratedMagnetometer` that reports uncalibrated magnetic field values.

The magnetic field is a field that exerts magnetic force on magnetometer sensor due to the magnetic effect generated by electric currents, magnetic materials or Earth’s magnetic force that is attributed to the combined effects of the planetary rotation and the movement of molten iron in the Earth’s core.

Hard iron distortion is created by objects that produce a magnetic field, such as magnetized iron.

Soft iron distortion stretches or distorts the magnetic field and is caused by metals such as nickel and iron.

The calibrated magnetic field is a magnetic field with hard iron distortion and soft iron distortion correction applied.

The uncalibrated magnetic field is the magnetic field without hard iron distortion correction and with soft iron distortion correction applied, and as such reports changes in the magnetic field caused by magnetized objects moving near the magnetometer.

## 2. Examples

    let sensor = new Magnetometer();
    sensor.start();

    sensor.onreading = () => {
        console.log("Magnetic field along the X-axis " + sensor.x);
        console.log("Magnetic field along the Y-axis " + sensor.y);
        console.log("Magnetic field along the Z-axis " + sensor.z);
    };

    sensor.onerror = event => console.log(event.error.name, event.error.message);

## 3. Security and Privacy Considerations

Magnetometer provides information about magnetic field, and in theory, can expose location of a user. For example, attack vector could be pre-magnetized surface in a particular location, or mapping between location and constant magnetic field disturbances caused by the building. Due to non-uniform strength of the Earth’s magnetic field, another attack vector could be exposure or validation of the user’s location. For example, if the end user is connected through VPN, magnetic field associated with geo IP information can be compared with magnetometer readings at real location, therefore, tell whether user is using VPN or not.

Uncalibrated magnetometer readings could be affected by magnetized objects nearby, such as jewelry, thereby exposing information that might be used for keystroke monitoring.

To mitigate these specific threats, user agents should use one or both of the following mitigation strategies:

- limit maximum sampling frequency

- reduce accuracy of sensor readings

These mitigation strategies complement the generic mitigations defined in the Generic Sensor API [GENERIC-SENSOR].

## 4. Model

The Magnetometer sensor type has two associated `Sensor` subclasses, `Magnetometer` and `UncalibratedMagnetometer`.

The `Magnetometer` and `UncalibratedMagnetometer` have an associated sensor permission name which is "magnetometer".

The latest reading for a `Sensor` of Magnetometer sensor type includes three entries whose keys are "x", "y", "z" and whose values contain magnetic field about the corresponding axes. Values can contain also device’s uncalibrated magnetic field and hard iron distortion depending on which object was instantiated.

For uncalibrated magnetometer, the latest reading includes three entries whose keys are "x", "y", "z" and whose values contain uncalibrated magnetic field around the 3 different axes, and three additional entries whose keys are "xBias", "yBias", "zBias" and whose values contain the hard iron distortion correction around the 3 different axes.

The sign of the magnetic field values must be according to the right-hand convention in a local coordinate system (see figure below).

### 4.1. Reference Frame

The local coordinate system represents the reference frame for the `Magnetometer` and the `UncalibratedMagnetometer` readings. It can be either the device coordinate system or the screen coordinate system.

## 5. API

### 5.1. The Magnetometer Interface

    [SecureContext,
      Exposed=Window]
    interface Magnetometer : Sensor {
      constructor(optional MagnetometerSensorOptions sensorOptions = {});
      readonly attribute double? x;
      readonly attribute double? y;
      readonly attribute double? z;
    };

    enum MagnetometerLocalCoordinateSystem { "device", "screen" };

    dictionary MagnetometerSensorOptions : SensorOptions {
      MagnetometerLocalCoordinateSystem referenceFrame = "device";
    };

To construct a `Magnetometer` object the user agent must invoke the construct a magnetometer object abstract operation for the `Magnetometer` interface.

Supported sensor options for `Magnetometer` are "frequency" and "referenceFrame".

#### 5.1.1. Magnetometer.x

The `x` attribute of the `Magnetometer` interface represents the magnetic field around X-axis. In other words, this attribute returns the result of invoking get value from latest reading with `this` and "x" as arguments.

#### 5.1.2. Magnetometer.y

The `y` attribute of the `Magnetometer` interface represents the magnetic field around Y-axis. In other words, this attribute returns the result of invoking get value from latest reading with `this` and "y" as arguments.

#### 5.1.3. Magnetometer.z

The `z` attribute of the `Magnetometer` interface represents the magnetic field around Z-axis. In other words, this attribute returns the result of invoking get value from latest reading with `this` and "z" as arguments.

### 5.2. The UncalibratedMagnetometer Interface

    [SecureContext,
      Exposed=Window]
    interface UncalibratedMagnetometer : Sensor {
      constructor(optional MagnetometerSensorOptions sensorOptions = {});
      readonly attribute double? x;
      readonly attribute double? y;
      readonly attribute double? z;
      readonly attribute double? xBias;
      readonly attribute double? yBias;
      readonly attribute double? zBias;
    };

To construct an `UncalibratedMagnetometer` object the user agent must invoke the construct a magnetometer object abstract operation for the `UncalibratedMagnetometer` interface.

Supported sensor options for `UncalibratedMagnetometer` are "frequency" and "referenceFrame".

#### 5.2.1. UncalibratedMagnetometer.x

The `x` attribute of the `UncalibratedMagnetometer` interface represents the uncalibrated magnetic field around X-axis. In other words, this attribute returns the result of invoking get value from latest reading with `this` and "x" as arguments.

#### 5.2.2. UncalibratedMagnetometer.y

The `y` attribute of the `UncalibratedMagnetometer` interface represents the uncalibrated magnetic field around Y-axis. In other words, this attribute returns the result of invoking get value from latest reading with `this` and "y" as arguments.

#### 5.2.3. UncalibratedMagnetometer.z

The `z` attribute of the `UncalibratedMagnetometer` interface represents the uncalibrated magnetic field around Z-axis. In other words, this attribute returns the result of invoking get value from latest reading with `this` and "z" as arguments.

#### 5.2.4. UncalibratedMagnetometer.xBias

The `xBias` attribute of the `UncalibratedMagnetometer` interface represents the hard iron distortion correction around X-axis. In other words, this attribute returns the result of invoking get value from latest reading with `this` and "xBias" as arguments.

#### 5.2.5. UncalibratedMagnetometer.yBias

The `yBias` attribute of the `UncalibratedMagnetometer` interface represents the hard iron distortion correction around Y-axis. In other words, this attribute returns the result of invoking get value from latest reading with `this` and "yBias" as arguments.

#### 5.2.6. UncalibratedMagnetometer.zBias

The `zBias` attribute of the `UncalibratedMagnetometer` interface represents the hard iron distortion correction around Z-axis. In other words, this attribute returns the result of invoking get value from latest reading with `this` and "zBias" as arguments.

## 6. Abstract Operations

### 6.1. Construct a magnetometer object

input

  magnetometer_interface, a `Magnetometer` interface identifier or an `UncalibratedMagnetometer` interface identifier.

  options, a `MagnetometerSensorOptions` object.

output

  A `Magnetometer` or `UncalibratedMagnetometer` object.

1. Let allowed be the result of invoking check sensor policy-controlled features with `Magnetometer`.

2. If allowed is false, then:

   1. Throw a `SecurityError` `DOMException`.

3. Let magnetometer be a new instance of the interface identified by magnetometer_interface.

4. Invoke initialize a sensor object with magnetometer and options.

5. If options.`referenceFrame` is "screen", then:

   1. Define local coordinate system for magnetometer as the screen coordinate system.

6. Otherwise, define local coordinate system for magnetometer as the device coordinate system.

7. Return magnetometer.

## 7. Automation

This section extends the automation section defined in the Generic Sensor API [GENERIC-SENSOR] to provide mocking information about the magnetic field in the X, Y and Z axis for the purposes of testing a user agent’s implementation of `Magnetometer` and `UncalibratedMagnetometer` APIs.

### 7.1. Mock Sensor Type

The `Magnetometer` class has an associated mock sensor type which is "magnetometer", its mock sensor reading values dictionary is defined as follows:

    dictionary MagnetometerReadingValues {
      required double? x;
      required double? y;
      required double? z;
    };

The `UncalibratedMagnetometer` class has an associated mock sensor type which is "uncalibrated-magnetometer", its mock sensor reading values dictionary is defined as follows:

    dictionary UncalibratedMagnetometerReadingValues {
      required double? x;
      required double? y;
      required double? z;
      required double? xBias;
      required double? yBias;
      required double? zBias;
    };

## 8. Limitations of Magnetometer Sensors

This section is non-normative.

The direction and magnitude of the Earth’s field changes with location, latitude in particular. For example, the magnitude is lowest near the equator and highest near the poles. Some hard-iron interference, meaning presence of permanent magnets (e.g. magnets in the speaker of a phone) in the vicinity of the sensor also affects the accuracy of the reading. Presence of electronic items, laptops, batteries, etc also contribute to the soft iron interference. Flight Mode option in mobile phones might help in decreasing the electro magnetic interference.

In addition to the above spatial variations of the magnetic field, time based variations, like solar winds or magnetic storms, also distort the magnetosphere or external magnetic field of the Earth.

## 9. Use Cases and Requirements

This section is non-normative.

Magnetometers can be used for a variety of use-cases, for example:

- Sensor fusion. A common use-case for magnetometers is sensor fusion in order to generate an Absolute Orientation Sensor [MOTION-SENSORS] which is stationary to the Earth plane, or a compass, which is basically the former with corrections to the declination depending on geolocation position, such that it points to the true north. Calculating compass heading as detailed in § 10 Compass Heading Using Magnetometers.

- Virtual Reality and Augmented Reality. Magnetometer can be used to implement input using magnetic button for VR enclosures [VRBUTTON]. Head-mount tracking systems for VR and AR can use magnetometer data to help in calibration of gyroscope readings and align yaw readings with the magnetic north.

- Gesture recognition. Various interactions like writing, signing and playing an instrument can also be enabled using a magnet like a rod, pen or a ring [MAGITACT]. The user makes coarse gestures in the 3D space around the device using the magnet. Movement of the magnet affects the magnetic field sensed by the compass sensor integrated in the device. The temporal pattern of the gesture can be used as a basis for sending different interaction commands to the mobile device. Zooming, turning pages, accepting/rejecting calls, clicking items are some of the use cases.

- Indoor navigation. Navigation systems can use magnetometer data on mobile devices [MAGINDOORPOS] to detect the magnetic field inside a building. With sufficient local variability, the anomalies can be utilized in self-localization. Use cases for indoor navigation include, for example, proximity advertising, way finding in malls or airports, and geofencing.

- Metal detection. Magnetometers can be used by utility applications to detect the presence of metal nearby, e.g. finding inclusions hidden within objects.

Requirements with respect to data coarseness and sampling frequency can vary depending on the use case at hand. For example, metal detection or input using magnetic button can likely be implemented with coarser data and using lower sampling frequency compared to gesture recognition, indoor navigation, or VR and AR use cases. In sensor fusion use cases, the sampling frequency that yeilds optimal results is dependent on e.g. sensor fusion algorithm and characteristics of other motion sensors involved.

## 10. Compass Heading Using Magnetometers

This section is non-normative.

Compasses, instruments that align themselves with the magnetic poles of the Earth, have been used in navigation for centuries. The Earth’s rotational axis defines the geographic north and south poles that we use for map references. It turns out that there is a discrepancy of around 11.5 degrees (around 1000 miles) between the geographic poles and the magnetic poles. Declination angle is applied to the magnetic direction to correct for this situation.

If the device is always level to the Earth’s surface, compass heading can be determined by using just the `x` and `y` component of the Earth’s magnetic field, that is, the directions planar with the Earth’s surface. To determine geographic north (or true north) heading, add the appropriate declination angle.

Magnetic declination or declination angle is the angle on the horizontal plane between magnetic north and the true north and depends on the position on the Earth’s surface, and changes over time. By convention, declination is positive when magnetic north is east of true north, and negative when it is to the west. You can get real time value for magnetic declination e.g. using the Magnetic declination calculator provided by the National Oceanic and Atmospheric Administration (NOAA).

The magnetic north is calculated as follows:

    let sensor = new Magnetometer();
    sensor.start();
    let heading = Math.atan2(sensor.y, sensor.x) * (180 / Math.PI);
    console.log('Heading in degrees: ' + heading);

The geographic north at a given latitude and longitude can be calculated as follows:

    // Get the latitude and longitude, omitted for brevity here.
    let latitude = 0, longitude = 0;

    // Get the magnetic declination at the given latitude and longitude.
    fetch('https://www.ngdc.noaa.gov/geomag-web/calculators/calculateDeclination' +
          '?lat1=' + latitude + '&lon1=' + longitude + '&resultFormat=csv')
      .then(response => response.text()).then(text => {
        let declination = parseFloat(text.replace(/^#.*$/gm, '').trim().split(',')[4]);

        // Compensate for the magnetic declination to get the geographic north.
        console.log('True heading in degrees: ' + (heading + declination));
    });

Note: If the device is not level to the Earth’s surface, a developer needs to apply various tilt compensation techniques for which she needs a 3-axis accelerometer. Data from the orientation sensor, which is a fusion of the accelerometer and magnetometer sensors, is required to implement this particular use case.

## 11. Acknowledgements

Tobie Langel for the work on Generic Sensor API.

## 12. Conformance

Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.

All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

A conformant user agent must implement all the requirements listed in this specification that are applicable to user agents.

The IDL fragments in this specification must be interpreted as required for conforming IDL fragments, as described in the Web IDL specification. [WEBIDL]

## Index

### Terms defined by this specification

- calibrated magnetic field, in §1
- conformant user agent, in §12
- Construct a magnetometer object, in §6
- constructor()
  - constructor for Magnetometer, in §5.1
  - constructor for UncalibratedMagnetometer, in §5.2
- constructor(sensorOptions)
  - constructor for Magnetometer, in §5.1
  - constructor for UncalibratedMagnetometer, in §5.2
- declination angle, in §10
- "device", in §5.1
- Hard iron distortion, in §1
- Magnetic declination, in §10
- magnetic field, in §1
- Magnetometer
  - (interface), in §5.1
  - definition of, in §4
- Magnetometer(), in §5.1
- MagnetometerLocalCoordinateSystem, in §5.1
- MagnetometerReadingValues, in §7.1
- Magnetometer(sensorOptions), in §5.1
- MagnetometerSensorOptions, in §5.1
- referenceFrame, in §5.1
- "screen", in §5.1
- Soft iron distortion, in §1
- uncalibrated magnetic field, in §1
- UncalibratedMagnetometer, in §5.2
- UncalibratedMagnetometer(), in §5.2
- UncalibratedMagnetometerReadingValues, in §7.1
- UncalibratedMagnetometer(sensorOptions), in §5.2
- x
  - attribute for Magnetometer, in §5.1
  - attribute for UncalibratedMagnetometer, in §5.2
  - dict-member for MagnetometerReadingValues, in §7.1
  - dict-member for UncalibratedMagnetometerReadingValues, in §7.1
- xBias
  - attribute for UncalibratedMagnetometer, in §5.2
  - dict-member for UncalibratedMagnetometerReadingValues, in §7.1
- y
  - attribute for Magnetometer, in §5.1
  - attribute for UncalibratedMagnetometer, in §5.2
  - dict-member for MagnetometerReadingValues, in §7.1
  - dict-member for UncalibratedMagnetometerReadingValues, in §7.1
- yBias
  - attribute for UncalibratedMagnetometer, in §5.2
  - dict-member for UncalibratedMagnetometerReadingValues, in §7.1
- z
  - attribute for Magnetometer, in §5.1
  - attribute for UncalibratedMagnetometer, in §5.2
  - dict-member for MagnetometerReadingValues, in §7.1
  - dict-member for UncalibratedMagnetometerReadingValues, in §7.1
- zBias
  - attribute for UncalibratedMagnetometer, in §5.2
  - dict-member for UncalibratedMagnetometerReadingValues, in §7.1

https://w3c.github.io/accelerometer/#device-coordinate-system Referenced in:

- 4.1. Reference Frame
- 6.1. Construct a magnetometer object

https://w3c.github.io/accelerometer/#screen-coordinate-system Referenced in:

- 4.1. Reference Frame
- 6.1. Construct a magnetometer object

https://w3c.github.io/sensors/#dom-mocksensortype-magnetometer Referenced in:

- 7.1. Mock Sensor Type

https://w3c.github.io/sensors/#dom-mocksensortype-uncalibrated-magnetometer Referenced in:

- 7.1. Mock Sensor Type

https://w3c.github.io/sensors/#sensor Referenced in:

- 4. Model (2)
- 5.1. The Magnetometer Interface
- 5.2. The UncalibratedMagnetometer Interface

https://w3c.github.io/sensors/#dictdef-sensoroptions Referenced in:

- 5.1. The Magnetometer Interface

https://w3c.github.io/sensors/#automation Referenced in:

- 7. Automation

https://w3c.github.io/sensors/#check-sensor-policy-controlled-features Referenced in:

- 6.1. Construct a magnetometer object

https://w3c.github.io/sensors/#get-value-from-latest-reading Referenced in:

- 5.1.1. Magnetometer.x
- 5.1.2. Magnetometer.y
- 5.1.3. Magnetometer.z
- 5.2.1. UncalibratedMagnetometer.x
- 5.2.2. UncalibratedMagnetometer.y
- 5.2.3. UncalibratedMagnetometer.z
- 5.2.4. UncalibratedMagnetometer.xBias
- 5.2.5. UncalibratedMagnetometer.yBias
- 5.2.6. UncalibratedMagnetometer.zBias

https://w3c.github.io/sensors/#initialize-a-sensor-object Referenced in:

- 6.1. Construct a magnetometer object

https://w3c.github.io/sensors/#keystroke-monitoring Referenced in:

- 3. Security and Privacy Considerations

https://w3c.github.io/sensors/#latest-reading Referenced in:

- 4. Model (2)

https://w3c.github.io/sensors/#limit-max-frequency Referenced in:

- 3. Security and Privacy Considerations

https://w3c.github.io/sensors/#local-coordinate-system Referenced in:

- 4. Model
- 4.1. Reference Frame
- 6.1. Construct a magnetometer object (2)

https://w3c.github.io/sensors/#mitigation-strategies Referenced in:

- 3. Security and Privacy Considerations

https://w3c.github.io/sensors/#mock-sensor-reading-values Referenced in:

- 7.1. Mock Sensor Type (2)

https://w3c.github.io/sensors/#mock-sensor-type Referenced in:

- 7.1. Mock Sensor Type (2)

https://w3c.github.io/sensors/#reduce-accuracy Referenced in:

- 3. Security and Privacy Considerations

https://w3c.github.io/sensors/#sensor-permission-names Referenced in:

- 4. Model

https://w3c.github.io/sensors/#sensor-reading Referenced in:

- 4.1. Reference Frame

https://w3c.github.io/sensors/#sensor-type Referenced in:

- 4. Model (2)

https://w3c.github.io/sensors/#supported-sensor-options Referenced in:

- 5.1. The Magnetometer Interface
- 5.2. The UncalibratedMagnetometer Interface

https://infra.spec.whatwg.org/#map-entry Referenced in:

- 4. Model (2) (3)

https://infra.spec.whatwg.org/#map-key Referenced in:

- 4. Model (2) (3)

https://infra.spec.whatwg.org/#map-value Referenced in:

- 4. Model (2) (3)

https://w3c.github.io/motion-sensors/#absolute-orientation Referenced in:

- 9. Use Cases and Requirements

https://w3c.github.io/permissions/#dom-permissionname-magnetometer Referenced in:

- 4. Model

https://heycam.github.io/webidl/#idl-DOMException Referenced in:

- 6.1. Construct a magnetometer object

https://heycam.github.io/webidl/#Exposed Referenced in:

- 5.1. The Magnetometer Interface
- 5.2. The UncalibratedMagnetometer Interface

https://heycam.github.io/webidl/#SecureContext Referenced in:

- 5.1. The Magnetometer Interface
- 5.2. The UncalibratedMagnetometer Interface

https://heycam.github.io/webidl/#securityerror Referenced in:

- 6.1. Construct a magnetometer object

https://heycam.github.io/webidl/#idl-double Referenced in:

- 5.1. The Magnetometer Interface (2) (3)
- 5.2. The UncalibratedMagnetometer Interface (2) (3) (4) (5) (6)
- 7.1. Mock Sensor Type (2) (3) (4) (5) (6) (7) (8) (9)

https://heycam.github.io/webidl/#dfn-identifier Referenced in:

- 6.1. Construct a magnetometer object (2)

https://heycam.github.io/webidl/#dfn-interface Referenced in:

- 6.1. Construct a magnetometer object (2) (3)

https://heycam.github.io/webidl/#dfn-throw Referenced in:

- 6.1. Construct a magnetometer object

### Terms defined by reference

- [accelerometer] defines the following terms:
  - device coordinate system
  - screen coordinate system
- [GENERIC-SENSOR] defines the following terms:
  - "magnetometer"
  - "uncalibrated-magnetometer"
  - Sensor
  - SensorOptions
  - automation
  - check sensor policy-controlled features
  - get value from latest reading
  - initialize a sensor object
  - keystroke monitoring
  - latest reading
  - limit maximum sampling frequency
  - local coordinate system
  - mitigation strategies
  - mock sensor reading values
  - mock sensor type
  - reduce accuracy
  - sensor permission name
  - sensor readings
  - sensor type
  - supported sensor options
- [INFRA] defines the following terms:
  - entry
  - key
  - value
- [motionsensors] defines the following terms:
  - absolute orientation sensor
- [permissions] defines the following terms:
  - "magnetometer"
- [WEBIDL] defines the following terms:
  - DOMException
  - Exposed
  - SecureContext
  - SecurityError
  - double
  - identifier
  - interface
  - throw

## References

### Normative References

[ACCELEROMETER]
  Anssi Kostiainen. Accelerometer. 7 March 2019. WD. URL: https://www.w3.org/TR/accelerometer/
[GENERIC-SENSOR]
  Mikhail Pozdnyakov; Alexander Shalamov; Tobie Langel. Generic Sensor API. 7 March 2019. WD. URL: https://www.w3.org/TR/generic-sensor/
[INFRA]
  Anne van Kesteren; Domenic Denicola. Infra Standard. Living Standard. URL: https://infra.spec.whatwg.org/
[PERMISSIONS]
  Mounir Lamouri; Marcos Caceres; Jeffrey Yasskin. Permissions. 25 September 2017. WD. URL: https://www.w3.org/TR/permissions/
[RFC2119]
  S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119
[WEBIDL]
  Boris Zbarsky. Web IDL. 15 December 2016. ED. URL: https://heycam.github.io/webidl/

### Informative References

[MAGINDOORPOS]
  Janne Haverinen, Anssi Kemppainen. Global indoor self-localization based on the ambient magnetic field. Informational. URL: https://doi.org/10.1016%2Fj.robot.2009.07.018
[MAGITACT]
  Hamed Ketabdar, Kamer Ali Yüksel, Mehran Roshandel. Magitact. Informational. URL: http://dl.acm.org/citation.cfm?id=1720048
[MOTION-SENSORS]
  Kenneth Christiansen; Alexander Shalamov. Motion Sensors Explainer. 30 August 2017. NOTE. URL: https://www.w3.org/TR/motion-sensors/
[VRBUTTON]
  Boris Smus. Magnetic input for Google cardboard. Informational. URL: https://bugs.chromium.org/p/chromium/issues/detail?id=445926

## IDL Index

    [SecureContext,
      Exposed=Window]
    interface Magnetometer : Sensor {
      constructor(optional MagnetometerSensorOptions sensorOptions = {});
      readonly attribute double? x;
      readonly attribute double? y;
      readonly attribute double? z;
    };

    enum MagnetometerLocalCoordinateSystem { "device", "screen" };

    dictionary MagnetometerSensorOptions : SensorOptions {
      MagnetometerLocalCoordinateSystem referenceFrame = "device";
    };

    [SecureContext,
      Exposed=Window]
    interface UncalibratedMagnetometer : Sensor {
      constructor(optional MagnetometerSensorOptions sensorOptions = {});
      readonly attribute double? x;
      readonly attribute double? y;
      readonly attribute double? z;
      readonly attribute double? xBias;
      readonly attribute double? yBias;
      readonly attribute double? zBias;
    };

    dictionary MagnetometerReadingValues {
      required double? x;
      required double? y;
      required double? z;
    };

    dictionary UncalibratedMagnetometerReadingValues {
      required double? x;
      required double? y;
      required double? z;
      required double? xBias;
      required double? yBias;
      required double? zBias;
    };

#magnetic-field Referenced in:

- 1. Introduction (2) (3) (4) (5) (6) (7)
- 4. Model (2)
- 5.1.1. Magnetometer.x
- 5.1.2. Magnetometer.y
- 5.1.3. Magnetometer.z
- 7. Automation
- 8. Limitations of Magnetometer Sensors

#hard-iron-distortion Referenced in:

- 1. Introduction (2)
- 4. Model (2)
- 5.2.4. UncalibratedMagnetometer.xBias
- 5.2.5. UncalibratedMagnetometer.yBias
- 5.2.6. UncalibratedMagnetometer.zBias

#soft-iron-distortion Referenced in:

- 1. Introduction (2)

#calibrated-magnetic-field Referenced in:

- 1. Introduction

#uncalibrated-magnetic-field Referenced in:

- 1. Introduction
- 4. Model (2)
- 5.2.1. UncalibratedMagnetometer.x
- 5.2.2. UncalibratedMagnetometer.y
- 5.2.3. UncalibratedMagnetometer.z

#magnetometer-sensor-type Referenced in:

- 4. Model

#magnetometer Referenced in:

- 1. Introduction
- 4. Model (2)
- 4.1. Reference Frame
- 5.1. The Magnetometer Interface (2) (3)
- 5.1.1. Magnetometer.x
- 5.1.2. Magnetometer.y
- 5.1.3. Magnetometer.z
- 6.1. Construct a magnetometer object (2) (3)
- 7. Automation
- 7.1. Mock Sensor Type

#dom-magnetometer-x Referenced in:

- 5.1.1. Magnetometer.x
- 10. Compass Heading Using Magnetometers

#dom-magnetometer-y Referenced in:

- 5.1.2. Magnetometer.y
- 10. Compass Heading Using Magnetometers

#dom-magnetometer-z Referenced in:

- 5.1.3. Magnetometer.z

#enumdef-magnetometerlocalcoordinatesystem Referenced in:

- 5.1. The Magnetometer Interface

#dictdef-magnetometersensoroptions Referenced in:

- 5.1. The Magnetometer Interface
- 5.2. The UncalibratedMagnetometer Interface
- 6.1. Construct a magnetometer object

#dom-magnetometersensoroptions-referenceframe Referenced in:

- 6.1. Construct a magnetometer object

#uncalibratedmagnetometer Referenced in:

- 1. Introduction
- 4. Model (2)
- 4.1. Reference Frame
- 5.2. The UncalibratedMagnetometer Interface (2) (3)
- 5.2.1. UncalibratedMagnetometer.x
- 5.2.2. UncalibratedMagnetometer.y
- 5.2.3. UncalibratedMagnetometer.z
- 5.2.4. UncalibratedMagnetometer.xBias
- 5.2.5. UncalibratedMagnetometer.yBias
- 5.2.6. UncalibratedMagnetometer.zBias
- 6.1. Construct a magnetometer object (2)
- 7. Automation
- 7.1. Mock Sensor Type

#dom-uncalibratedmagnetometer-x Referenced in:

- 5.2.1. UncalibratedMagnetometer.x

#dom-uncalibratedmagnetometer-y Referenced in:

- 5.2.2. UncalibratedMagnetometer.y

#dom-uncalibratedmagnetometer-z Referenced in:

- 5.2.3. UncalibratedMagnetometer.z

#dom-uncalibratedmagnetometer-xbias Referenced in:

- 5.2.4. UncalibratedMagnetometer.xBias

#dom-uncalibratedmagnetometer-ybias Referenced in:

- 5.2.5. UncalibratedMagnetometer.yBias

#dom-uncalibratedmagnetometer-zbias Referenced in:

- 5.2.6. UncalibratedMagnetometer.zBias

#construct-a-magnetometer-object Referenced in:

- 5.1. The Magnetometer Interface
- 5.2. The UncalibratedMagnetometer Interface

#magnetic-declination Referenced in:

- 10. Compass Heading Using Magnetometers

#declination-angle Referenced in:

- 10. Compass Heading Using Magnetometers (2)