gpt4 book ai didi

c# - 从谷歌地图 v3 方向 api 的结果中获取纬度和经度?

转载 作者:太空宇宙 更新时间:2023-11-03 14:11:19 25 4
gpt4 key购买 nike

我在我的项目中使用 Google map v3 direction api

我将城市名称作为 起点终点 以获取该距离的距离和所用时间。

我还有一个要求是获取起点的经度和纬度,即城市名称。

我可以从 direction api 中获取它吗?我用它来获取 direction api 结果中的距离和时间?

如果我们可以从 direction api 的结果中获取纬度和经度,请帮助我给出正确的答案。

提前致谢。

最佳答案

响应不包含经纬度字符串。您必须使用函数来获取它。

使用 jquery 这对我有用。

$.each(result.routes[0].legs, function(index, route) {
alert(route.start_location.lat());
});

这将提醒您请求的旅程的每段起始纬度。

关于c# - 从谷歌地图 v3 方向 api 的结果中获取纬度和经度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7776713/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com