我想使用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点是否与圆成一直线!
谢谢
@@ Talha,您能够解决此问题吗?我有相同的...