How is the speed attribute in the Geolocation API calculated?

35 Views Asked by At

Is there a standard way the speed attribute in the GeolocatinCoordintes interface of the Geolocation is calculated by different browsers?

The latest W3 draft is rather vague and so are the mdn web docs about the subject.

1

There are 1 best solutions below

0
deceze On

The introduction of the W3 spec you link to states this:

The Geolocation API defines a high-level interface to location information associated only with the device hosting the implementation. Common sources of location information include Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs, as well as user input. The API itself is agnostic of the underlying location information sources, and no guarantee is given that the API returns the device's actual location.

In other words, the web API specification does not and cannot prescribe where the actual data comes from nor guarantee its accuracy in any way; this is intentionally left up to each individual device implementing the specification, and may vary widely based on the available hardware. The speed attribute described in the API merely allows the device to provide you a horizontal speed in meters per second. That's all. Nothing more, nothing less.