地址描述符请求和响应

地址描述符包含其他信息,可帮助您使用地标和区域描述地点。如需探索此功能,请查看地址描述符演示

其他参数

您可以使用 extra_computations 参数启用地址描述符。在地理编码请求反向地理编码请求地点地理编码请求中添加 extra_computations=ADDRESS_DESCRIPTORS,以便在响应中接收地址描述符。

地理编码示例

以下查询包含了德里某个地点的地址:

https://maps.googleapis.com/maps/api/geocode/json?address=4118,+Kalan+Mehal+Chandni+Chowk,+New+Delhi&extra_computations=ADDRESS_DESCRIPTORS&key=YOUR_API_KEY

地点地理编码示例

以下查询包含了德里某个地点的地点 ID:

https://maps.googleapis.com/maps/api/geocode/json?place_id=ChIJyxAX8Bj9DDkRgBfAnBYa66Q&extra_computations=ADDRESS_DESCRIPTORS&key=YOUR_API_KEY

反向地理编码示例

以下查询包含了德里某个位置的纬度/经度值:

https://maps.googleapis.com/maps/api/geocode/json?latlng=28.640964,77.235875&extra_computations=ADDRESS_DESCRIPTORS&key=YOUR_API_KEY

响应

address_descriptor 示例如下:

{
  "address_descriptor" : {
     "areas" : [
        {
           "containment" : "OUTSKIRTS",
           "display_name" : {
              "language_code" : "en",
              "text" : "Turkman Gate"
           },
           "place_id" : "ChIJ_7LLvyb9DDkRMKKxP9YyXgs"
        },
        {
           "containment" : "OUTSKIRTS",
           "display_name" : {
              "language_code" : "en",
              "text" : "Chandni Chowk"
           },
           "place_id" : "ChIJWcXciBr9DDkRUb4dCDykTwI"
        },
        {
           "containment" : "NEAR",
           "display_name" : {
              "language_code" : "en",
              "text" : "Katar Ganj"
           },
           "place_id" : "ChIJH3cWUyH9DDkRaw-9CjvcRvY"
        }
     ],
     "landmarks" : [
        {
           "display_name" : {
              "language_code" : "en",
              "text" : "Delite Cinema"
           },
           "straight_line_distance_meters" : 29.9306755065918,
           "place_id" : "ChIJLfiYDCT9DDkROoEa7NdupUM",
           "travel_distance_meters" : 418.7794799804688,
           "spatial_relationship" : "ACROSS_THE_ROAD",
           "types" : [ "establishment", "movie_theater", "point_of_interest" ]
        },
        {
           "display_name" : {
              "language_code" : "en",
              "text" : "YES Bank"
           },
           "straight_line_distance_meters" : 66.83731079101562,
           "place_id" : "ChIJFYHM3yb9DDkRRKGkZl2mpSQ",
           "travel_distance_meters" : 489.0340270996094,
           "spatial_relationship" : "DOWN_THE_ROAD",
           "types" : [ "bank", "establishment", "finance", "point_of_interest" ]
        },
        {
           "display_name" : {
              "language_code" : "en",
              "text" : "UCO Bank"
           },
           "straight_line_distance_meters" : 25.38849639892578,
           "place_id" : "ChIJ-c6_wCb9DDkRjIk1LeqRtGM",
           "travel_distance_meters" : 403.2246398925781,
           "spatial_relationship" : "ACROSS_THE_ROAD",
           "types" : [ "atm", "bank", "establishment", "finance", "point_of_interest" ]
        },
        {
           "display_name" : {
              "language_code" : "en",
              "text" : "Delhi By Cycle Meeting Point"
           },
           "straight_line_distance_meters" : 44.02867126464844,
           "place_id" : "ChIJNxVfkSb9DDkRJD22l-eGFdM",
           "travel_distance_meters" : 97.41281890869141,
           "spatial_relationship" : "AROUND_THE_CORNER",
           "types" : [
              "establishment",
              "point_of_interest",
              "tourist_attraction",
              "travel_agency"
           ]
        },
        {
           "display_name" : {
              "language_code" : "en",
              "text" : "Axis Bank Branch"
           },
           "straight_line_distance_meters" : 102.3495178222656,
           "place_id" : "ChIJr3uaDCT9DDkR8roHTVSn1x4",
           "travel_distance_meters" : 330.8566284179688,
           "spatial_relationship" : "DOWN_THE_ROAD",
           "types" : [ "bank", "establishment", "finance", "point_of_interest" ]
        }
     ]
  }
}

每个 address_descriptor 对象中都有两个数组:landmarksareaslandmarks 数组最多包含 5 条结果,这些结果会按相关性排序,并考虑与请求的坐标的距离、地标的普及程度和可见性。每个地标结果都包含以下值:

  • place_id 是地标结果的地点 ID。请参阅地点 ID 概览
  • display_name 是地标的显示名称,包含 language_codetext
  • straight_line_distance_meters 表示输入坐标和地标结果之间的点对点距离(以米为单位)。
  • travel_distance_meters 是输入坐标与地图注点结果之间通过道路网格(忽略道路限制)行驶的距离(以米为单位)。
  • spatial_relationship 是输入坐标与地标结果之间的估算关系:
    • 如果不符合上述任何情况,则默认关系为 "NEAR"
    • 如果输入坐标包含在与地标相关联的结构的边界内,则为 "WITHIN"
    • 当输入坐标与地标或地标的接入点直接相邻时,使用 "BESIDE"
    • 如果输入坐标与相应路线另一侧的地标正好相反,则返回 "ACROSS_THE_ROAD"
    • 如果输入坐标与地标位于同一路线上,但不是 "BESIDES""ACROSS_THE_ROAD",则为 "DOWN_THE_ROAD"
    • 如果输入坐标与地标位于垂直路线上(仅限于单个转弯),则为 "AROUND_THE_CORNER"
    • 如果输入坐标在空间上靠近地标,但距离其接入点较远,则为 "BEHIND"
  • types 是地标的地点类型

areas 对象最多包含 3 个回答,并且仅限于代表小区域的地点,例如社区、子区域和大型建筑群。包含请求坐标的区域会先列出,并按面积从小到大排序。每个 areas 结果包含以下值:

  • place_id 是相应区域结果的地点 ID。请参阅地点 ID 概览
  • display_name 是该区域的显示名,包含 language_codetext
  • containment 是输入坐标与区域结果之间的估算包含关系:
    • 当以下项均不适用时,"NEAR" 是默认关系。
    • 如果输入坐标接近区域中心,则为 "WITHIN"
    • 当输入坐标靠近区域边缘时为 "OUTSKIRTS"

覆盖率

地址描述符适用于所有地区。如需了解详情,请参阅区域覆盖范围

反馈

这是预览版功能,我们期待收到您的反馈。请发送电子邮件至 address-descriptors-feedback@google.com