Google maps 爱奥尼亚原生谷歌地图如何显示中心点和非常标记
嘿,伙计们,我使用的是爱奥尼亚原生谷歌地图插件,我试图显示屏幕上的所有点以及用户位置,我可以做到,没问题,问题是我需要用户的位置在地图中居中,并显示他周围的所有点 我一直在尝试使用将我的所有点放入一个新的LatLngBounds中,并使用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 =
.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() );
}
你想要那样的东西吗?