【问题标题】:How to get only the road names on a route, with google maps如何使用谷歌地图仅获取路线上的道路名称
【发布时间】:2014-07-23 16:49:10
【问题描述】:

对于我正在做的项目,我需要获取路线上的道路名称。

所以当我从阿姆斯特丹到埃因霍温时,我会经过以下道路,例如 A4、A5、A27

我的问题是,我如何通过给出我的出发地和目的地从谷歌地图 api 获取这些道路?

非常感谢所有帮助。

提前致谢

【问题讨论】:

    标签: google-maps-api-3 geocoding


    【解决方案1】:

    您在哪里使用 Google Maps API 您会得到 JSON 格式的返回。

    这样;

    {
      "status": "OK",
      "results": [ {
        "types": street_address,
        "formatted_address": "275-291 Bedford Ave, Brooklyn, NY 11211, USA",
        "address_components": [ {
          "long_name": "275-291",
          "short_name": "275-291",
          "types": street_number
        }, {
          "long_name": "Bedford Ave",
          "short_name": "Bedford Ave",
          "types": route
        }, {
          "long_name": "New York",
          "short_name": "New York",
          "types": [ "locality", "political" ]
        }, {
          "long_name": "Brooklyn",
          "short_name": "Brooklyn",
          "types": [ "administrative_area_level_3", "political" ]
        }, {
          "long_name": "Kings",
          "short_name": "Kings",
          "types": [ "administrative_area_level_2", "political" ]
        }, {
          "long_name": "New York",
          "short_name": "NY",
          "types": [ "administrative_area_level_1", "political" ]
        }, {
          "long_name": "United States",
          "short_name": "US",
          "types": [ "country", "political" ]
        }, {
          "long_name": "11211",
          "short_name": "11211",
          "types": postal_code
        } ],
        "geometry": {
          "location": {
            "lat": 40.7142298,
            "lng": -73.9614669
          },
          "location_type": "RANGE_INTERPOLATED",
          "viewport": {
            "southwest": {
              "lat": 40.7110822,
              "lng": -73.9646145
            },
            "northeast": {
              "lat": 40.7173774,
              "lng": -73.9583193
            }
          }
        }
      },
    

    从地址中选择长名称和短名称。

    【讨论】:

    • 您好 ivanfromer,感谢您的回复,但这不是我的意思。我需要特定路线的道路名称。假设您从曼哈顿到纽约华尔街,我想拥有从曼哈顿到华尔街时经过的道路。我希望你明白我的意思。非常感谢您的帮助。
    猜你喜欢
    • 1970-01-01
    • 2012-12-27
    • 2012-12-08
    • 2015-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多