【问题标题】:Show data from Google Directions API on Google Maps在 Google 地图上显示来自 Google Directions API 的数据
【发布时间】:2014-02-01 20:29:51
【问题描述】:

我从 Google Directions API 获得了 JSON 数据。如何使用 Google Maps API 在地图上显示这条路线?

【问题讨论】:

    标签: google-maps


    【解决方案1】:

    使用Google Maps Javascript API v3 DirectionsServiceDirectionsRenderer,您可以避免从 Google Directions API 获取 JSON 数据(Google Maps Javascript API v3 DirectionsService 返回一个 JSON 结果,DirectionRenderer 可以直接显示)。

    看到这个example from the documentation

    【讨论】:

    • 我需要向 Google Directions API 询问 JSON 数据,然后将其存储在数据库中。我可以使用这些数据加载到 Google Maps API 中吗?
    • 请阅读terms of service (10.1.3)。我的理解是你只能暂时将这样的数据保存在你的数据库中,但是 IANAL。我已经看到了关于序列化该响应、存储它并稍后使用它的讨论,我自己还没有这样做。
    【解决方案2】:

    查看我在这个主题上写的这篇博文,它将准确地解释如何实现你正在寻找的东西:

    Google Maps: Draw Driving Direction on Map:

    有一个代码和一个示例项目可供您使用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-20
      • 2022-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多