显示方向的每一步地理编码
Google Maps API 可以构建从源到目的地的路线。在以下 Google 示例中,每个步骤都发布到 HTML 代码中: http://code.google.com/apis/maps/documentation/examples/directions-simple.html
我想获取此方向每个步骤的地理编码,并将它们存储在数组中。我相信这是可能的,但我不知道如何处理。
非常感谢您的回答。 问候
Google Maps API can build a Direction from a source to a destination. In the following Google's example, each step are published into the HTML code: http://code.google.com/apis/maps/documentation/examples/directions-simple.html
I would like to get the Geocoding of each step of this direction, and store them in a array. I believe it's possible, but I don't see how to process.
Many Thanks for any answer.
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您可以轻松地从 GDirections 获取各个步骤。
首先,您必须确保在调用
GDirections.load()
方法时传递getSteps: true
选项。然后,您可以简单地迭代GDirections.getRoute(i).getStep(j)
,如以下示例所示:进一步阅读和参考:
Yes, you can get the individual steps from GDirections very easily.
First you have to make sure to pass the
getSteps: true
option when you call theGDirections.load()
method. Then you can simply iterate throughGDirections.getRoute(i).getStep(j)
, as in the following example:Further reading and reference: