无法读取googlemaps Angular 8打字稿-几何中未定义的属性'球面'

问题描述 投票:-1回答:1

我想使用googlemaps打字稿库计算两个LatLng点之间的距离。我还安装了AGM模块,并将其完美地用于系统的其他部分。在Google地图中调用“几何”的“球面”时出现错误。

我的代码是

let distance = google.maps.geometry.spherical.computeDistanceBetween(london, manchester)

这里伦敦和曼彻斯特是正确的'google.maps.LatLng's。

我收到以下错误:

TypeError: Cannot read property 'spherical' of undefined

在我的app.module.ts中:

AgmCoreModule.forRoot({
    apiKey: 'MY_API_KEY', 
    libraries: ['geometry', 'places']
}),

P.S。我的主要目的是查看LatLng点是否与圆成一直线!

谢谢

angular typescript google-maps angular8 angular-google-maps
1个回答
0
投票

@@ Talha,您能够解决此问题吗?我有相同的...

© www.soinside.com 2019 - 2024. All rights reserved.