Storing coordinates (geolocation) in array to calculate distance

前端 未结 2 547
旧巷少年郎
旧巷少年郎 2021-01-21 22:43

Me and my partner are working on an exercise web application for our school thesis. We are trying to get a runner\'s position and track him during his workout with the watchpos

2条回答
  •  天命终不由人
    2021-01-21 23:29

    I am also wondering where to add the enableHighAccuray option. I tried the following:

            function startWatcher(callback, options) {
            if ("geolocation" in navigator) {
                // Watch position updates
                watchCallback = callback;
                // Watch for updates
                watchID = navigator.geolocation.watchPosition(appendPosition, displayError, {
        enableHighAccuracy:true
     });
                var registerWatchPosition = function(position) {
                    appendPosition(position);
                };
            } else {
                alert('Geolocation is not supported!');
            }
        }
    

    But didn't work as expected...

    Thanks!

提交回复
热议问题