Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ionic framework 如何在离子3中获得更精确的地理定位_Ionic Framework_Ionic3 - Fatal编程技术网

Ionic framework 如何在离子3中获得更精确的地理定位

Ionic framework 如何在离子3中获得更精确的地理定位,ionic-framework,ionic3,Ionic Framework,Ionic3,我有一个已经开发的应用程序,需要在我请求时提供准确的地理位置信息 到目前为止,它只在大约40%的时间内提供正确的信息。有什么我遗漏的吗 下面是为获取它而编写的函数 initMap(){ let optionsGPS = {timeout: 20000, enableHighAccuracy: true}; this.geolocation.getCurrentPosition(optionsGPS).then((position) => { let latLng = new go

我有一个已经开发的应用程序,需要在我请求时提供准确的地理位置信息

到目前为止,它只在大约40%的时间内提供正确的信息。有什么我遗漏的吗

下面是为获取它而编写的函数

 initMap(){

let optionsGPS = {timeout: 20000, enableHighAccuracy: true};
this.geolocation.getCurrentPosition(optionsGPS).then((position) => {

  let latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
  let mylat =  position.coords.latitude;
  let mylng =  position.coords.longitude;
  let mylatlng = {
    'lat': mylat,
    'lng': mylng
  };

  let mapOptions = {
    center: latLng,
    zoom: 16,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }

  this.map = new google.maps.Map(this.mapElement.nativeElement, mapOptions);
  this.addMarker(mylatlng, 'You', 'you');

  for (let provider of this.myProviders) {

    this.addMarker(provider, provider['name'], provider['type']);
  }
});
}


任何建议都将不胜感激。

你们可以试一下,你们可以得到位置某物大约五倍,然后平均他们。你们可以试一下,你们可以得到位置某物大约五倍,然后平均他们。