【问题标题】:Google maps API zipcode to zipcode driving directionsGoogle 将 API 邮政编码映射到邮政编码行车路线
【发布时间】:2021-10-25 19:33:45
【问题描述】:

我正在按照 Google gCloud 指南绘制地图(嵌入到 iframe 中)。在我的问题中,起点和终点是数字邮政编码。

这是我使用的网址:

https://www.google.com/maps/embed/v1/directions?key=MY_API_KEY&origin=address=07304&destination=90210

这是我得到的:

当我应该得到这个时:

这将获得真正的原产地(新泽西州泽西市),但对于 90210(加利福尼亚州比佛利山庄),它会在纽约皇后区开展业务(90210 Laser)。

有没有一种方法可以在 URL 中指定 ZIPCODE 来源和 ZIPCODE 目的地,而无需先获取纬度、经度或城市名称;就像指定“07304”时一样?

我不限于谷歌地图,任何可以将邮政编码正确编码为邮政编码方向的免费或低成本服务都是一个很好的解决方案。

谢谢

【问题讨论】:

  • 您也可以使用 place_ids:origin=place_id:ChIJc9ESSthQwokR2_RHrCg_lwY&destination=place_id:ChIJ7xfS-zW8woARXNkAJzX5Hs。您可以查看Embed API documentation 了解更多信息。

标签: google-maps gcloud


【解决方案1】:

一个选项是:origin=zip 07304&destination=zip 90210

<iframe width="600" height="450" frameborder="0" style="border:0"
src="https://www.google.com/maps/embed/v1/directions?key=[API_KEY]&origin=zip 07304&destination=zip 90210" 
allowfullscreen></iframe>

live example

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-27
    • 2020-12-13
    • 2018-01-03
    • 2011-11-28
    相关资源
    最近更新 更多