From 819ddd0e192be5225d9135fd218bacb478f9e154 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Fri, 26 Jan 2018 09:39:25 +0100 Subject: [PATCH] Set enableHighAccuracy in geolocation example --- examples/geolocation.js | 4 ++++ src/ol/Geolocation.js | 2 ++ 2 files changed, 6 insertions(+) diff --git a/examples/geolocation.js b/examples/geolocation.js index 235a70cd27..f048913a60 100644 --- a/examples/geolocation.js +++ b/examples/geolocation.js @@ -34,6 +34,10 @@ const map = new Map({ }); const geolocation = new Geolocation({ + // enableHighAccuracy must be set to true to have the heading value. + trackingOptions: { + enableHighAccuracy: true + }, projection: view.getProjection() }); diff --git a/src/ol/Geolocation.js b/src/ol/Geolocation.js index baadde09dd..4b4cea52c7 100644 --- a/src/ol/Geolocation.js +++ b/src/ol/Geolocation.js @@ -246,6 +246,8 @@ Geolocation.prototype.getAltitudeAccuracy = function() { /** * Get the heading as radians clockwise from North. + * Note: depending on the browser, the heading is only defined if the `enableHighAccuracy` + * is set to `true` in the tracking options. * @return {number|undefined} The heading of the device in radians from north. * @observable * @api