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
Google maps 爱奥尼亚原生谷歌地图如何显示中心点和非常标记_Google Maps_Ionic Framework_Ionic4_Ionic Native - Fatal编程技术网

Google maps 爱奥尼亚原生谷歌地图如何显示中心点和非常标记

Google maps 爱奥尼亚原生谷歌地图如何显示中心点和非常标记,google-maps,ionic-framework,ionic4,ionic-native,Google Maps,Ionic Framework,Ionic4,Ionic Native,嘿,伙计们,我使用的是爱奥尼亚原生谷歌地图插件,我试图显示屏幕上的所有点以及用户位置,我可以做到,没问题,问题是我需要用户的位置在地图中居中,并显示他周围的所有点 我一直在尝试使用将我的所有点放入一个新的LatLngBounds中,并使用.extend()方法设置每个点,但它不起作用 请帮忙 async expandRadius() { const query = await this.queryPlaces(10); get(query).then(nearByPlaces =

嘿,伙计们,我使用的是爱奥尼亚原生谷歌地图插件,我试图显示屏幕上的所有点以及用户位置,我可以做到,没问题,问题是我需要用户的位置在地图中居中,并显示他周围的所有点

我一直在尝试使用将我的所有点放入一个新的LatLngBounds中,并使用
.extend()
方法设置每个点,但它不起作用

请帮忙

async expandRadius() {
    const query = await this.queryPlaces(10);
    get(query).then(nearByPlaces => {
      const foundPlaces = [];
        nearByPlaces.forEach( el => {
          const placesData = {
            distance: Math.floor(this.geo.point(this.centerPoint.latitude, this.centerPoint.longitude)
              .distance(el.geolocation.geopoint.latitude, el.geolocation.geopoint.longitude)),
              ...el
          };
          foundPlaces.push(placesData);
          // THE CENTER ISSUE STARTS HERE //
          const tmp = new LatLng(el.geolocation.geopoint.latitude, el.geolocation.geopoint.longitude);
          this.bounds.extend(tmp);
          this.map.addMarkerSync({
            position: {
              lat: tmp.lat,
              lng: tmp.lng
            },
            icon: {
              url: 'www/assets/icon/pin.png',
              size: {width: 23, height: 33},
            }
          });
        });
        this.map.moveCamera({
          target: this.bounds.getCenter(),
          tilt: 0,
        });
    })
    .catch()
    .finally( async () => await this.loading.dismiss() );
  }

你想要那样的东西吗?