2

I was building a geolocation application and I got the coordinates that are not accurate at all, it has a minimum 200000meters difference.

<template>
 <button @click="getLocation2">Location</button>
</template>
data(){
  return{
        options : {
        enableHighAccuracy: true,
        timeout: 10000
         }
        }     
}
methods :{
    success(pos){
        var crd = pos.coords;
        console.log('Your current position is:');
        console.log(`Latitude : ${crd.latitude}`);
        console.log(`Longitude: ${crd.longitude}`);
        console.log(`More or less ${crd.accuracy} meters.`);
    },
    error(err){alert(err)},

    getLocation2(){
      const geo = navigator.geolocation;
      geo.getCurrentPosition(this.success, this.error,this.options);
    },
}

I also tried 'vue-browser-geolocation' plugin which is also giving the same result, please suggest a better way to get accurate location cooredinates of a user.

Manu
  • 711
  • 8
  • 27

0 Answers0