Method: geocode.destinations.searchDestinations

此方法会执行目的地查找并返回目的地列表。

HTTP 请求

POST https://geocode.googleapis.com/v4alpha/geocode/destinations

网址采用 gRPC 转码语法。

请求正文

请求正文中包含结构如下的数据:

JSON 表示法
{
  "travelModes": [
    enum (NavigationPoint.TravelMode)
  ],
  "languageCode": string,
  "regionCode": string,

  // Union field primary_query can be only one of the following:
  "place": string,
  "addressQuery": {
    object (SearchDestinationsRequest.AddressQuery)
  },
  "locationQuery": {
    object (SearchDestinationsRequest.LocationQuery)
  }
  // End of list of possible types for union field primary_query.
}
字段
travelModes[]

enum (NavigationPoint.TravelMode)

可选。用于过滤导航点的出行方式。这会影响响应中返回的 navigationPoints 字段。如果为空,则可以返回所有出行方式的导航点。

languageCode

string

可选。应返回结果所用的语言。

regionCode

string

可选。区域代码。地区代码,以 ccTLD(“顶级域名”)双字符值的形式指定。此参数会根据适用法律影响结果。此参数还会影响但不会完全限制服务中的结果。

联合字段 primary_query。查询主要目的地。可以是地点、完全指定的地址或 LatLng 位置。信息极少的某些地点和地址无法转换为目的地。

目标是围绕指定的主查询构建的。

注意:仅支持可作为导航目的地的地点和地址。例如,表示住宅或公寓楼的地点可用作主要查询,但表示地点或行政区域的地点不能用作主要查询。primary_query 只能是下列其中一项:

place

string

地点的资源名称,格式为 places/{placeId}

addressQuery

object (SearchDestinationsRequest.AddressQuery)

街道地址。

locationQuery

object (SearchDestinationsRequest.LocationQuery)

确切位置。

响应正文

针对 DestinationService.SearchDestinations 的响应消息。

如果成功,响应正文将包含结构如下的数据:

JSON 表示法
{
  "destinations": [
    {
      object (Destination)
    }
  ]
}
字段
destinations[]

object (Destination)

目的地列表。

如果可以从主要查询中明确识别出主要目的地,则服务会返回一个结果。否则,该服务可能会返回多个结果以消除歧义,也可能不返回任何结果。

授权范围

需要以下 OAuth 范围之一:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/maps-platform.geocode

SearchDestinationsRequest.AddressQuery

您要搜索的街道地址。按照相关国家全国邮政服务使用的格式指定地址

JSON 表示法
{

  // Union field kind can be only one of the following:
  "address": {
    object (PostalAddress)
  },
  "addressQuery": string
  // End of list of possible types for union field kind.
}
字段
联合字段 kind。地址查询。kind 只能是下列其中一项:
address

object (PostalAddress)

邮政地址格式的街道地址。

addressQuery

string

格式为单行的街道地址。

SearchDestinationsRequest.LocationQuery

用于识别附近主要目的地的位置查询。

注意:如果位置查询是在包含子场所的建筑物内进行的,则返回的主要场所可能是子场所。在这些情况下,containingPlaces 字段将包含相应建筑物。

JSON 表示法
{

  // Union field kind can be only one of the following:
  "location": {
    object (LatLng)
  }
  // End of list of possible types for union field kind.
}
字段
联合字段 kind。位置信息查询。kind 只能是下列其中一项:
location

object (LatLng)

精确的 LatLng 位置。

目的地

目的地。这包括主要地点、相关地点、入口和导航点。

JSON 表示法
{
  "primary": {
    object (PlaceView)
  },
  "containingPlaces": [
    {
      object (PlaceView)
    }
  ],
  "subDestinations": [
    {
      object (PlaceView)
    }
  ],
  "landmarks": [
    {
      object (Landmark)
    }
  ],
  "entrances": [
    {
      object (Entrance)
    }
  ],
  "navigationPoints": [
    {
      object (NavigationPoint)
    }
  ]
}
字段
primary

object (PlaceView)

请求中由 primary_query 标识的主要地点。

containingPlaces[]

object (PlaceView)

包含主要位置的精度较低的位置。例如,包含此建筑物的公寓楼群。

subDestinations[]

object (PlaceView)

主要地点的更精确的子目的地。例如,建筑物中包含的单元。

注意:与 Places API 返回的 SubDestination 相比,此子目的地列表更详尽,并且每个子目的地都包含更多信息。

landmarks[]

object (Landmark)

可用于指示目的地位置或帮助到达目的地的地标。

entrances[]

object (Entrance)

相应目的地的入口。

navigationPoints[]

object (NavigationPoint)

相应目的地的导航点。

PlaceView

表示 Places API 中 Place 的视图。它还提供特定于目的地的其他信息,例如结构类型和显示多边形。

在某些情况下,具有相同地点 ID 的 PlaceView 可能与 Places API 针对 typesdisplayName 字段返回的内容不同。

JSON 表示法
{
  "place": string,
  "displayName": {
    object (LocalizedText)
  },
  "primaryType": string,
  "types": [
    string
  ],
  "formattedAddress": string,
  "postalAddress": {
    object (PostalAddress)
  },
  "structureType": enum (PlaceView.StructureType),
  "location": {
    object (LatLng)
  },
  "displayPolygon": {
    object
  }
}
字段
place

string

相应地点的资源名称,格式为 places/{placeId}

displayName

object (LocalizedText)

人类可读的地点说明。例如,“B 门”“麦当劳”

primaryType

string

相应地点的主要地点类型。如需查看可能的值的列表,请访问 https://developers.google.com/maps/documentation/places/web-service/place-types

注意:此字段并非始终填充内容。请准备好在这些情况下使用 types 字段。

types[]

string

相应地点的所有关联地点类型。如需查看可能的值的列表,请访问 https://developers.google.com/maps/documentation/places/web-service/place-types

formattedAddress

string

单行地址。

postalAddress

object (PostalAddress)

结构化地址。

structureType

enum (PlaceView.StructureType)

与相应地点对应的结构类型。

location

object (LatLng)

相应地点的位置。对于具有显示多边形的地点,这可能表示在地图上放置标记的好位置。

displayPolygon

object (Struct format)

采用 GeoJSON 格式的地点多边形轮廓,使用 RFC 7946 格式:https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6

注意:RFC 7946 格式支持 MultiPolygon,因此一个 displayPolygon 对象可以表示多个多边形。

PlaceView.StructureType

相应地点所代表的结构类型。

枚举
STRUCTURE_TYPE_UNSPECIFIED 未使用。
POINT 点状位置。
SECTION 建筑物的子部分。
BUILDING 建筑物。
GROUNDS 通常包含多栋建筑的大型区域,例如大学校园、公寓楼群或购物中心。

地标

地标用于指示目的地所在的位置,或帮助您到达目的地。

JSON 表示法
{
  "tags": [
    enum (Landmark.Tag)
  ],

  // Union field landmark can be only one of the following:
  "place": {
    object (PlaceView)
  }
  // End of list of possible types for union field landmark.
}
字段
tags[]

enum (Landmark.Tag)

用于描述地标在目的地背景下的用途的标记。

联合字段 landmark。地标。landmark 只能是下列其中一项:
place

object (PlaceView)

表示相应地标的地点。

Landmark.Tag

描述如何在目的地背景下使用地标的所有可能标记的列表。

如果某个地址同时具有 ADDRESSARRIVAL 标记,则表示该地标在本地非常显眼,并且靠近目的地。

枚举
TAG_UNSPECIFIED 未使用。
ADDRESS 可用于确定目的地大致位置的当地著名地点。通常在目的地几百米范围内。这些地标类似于 Geocoding API 的地址描述符功能返回的地标:https://developers.google.com/maps/documentation/geocoding/address-descriptors/requests-address-descriptors
ARRIVAL 可用于帮助到达目的地的地点。当您接近目的地时,此功能可用于导航。例如,此地标可能是目的地对面的一处地点。带有此标记的地标通常比带有 ADDRESS 标记的地标更靠近目的地。

入口

入口是指单个纬度/经度坐标对,用于定义某个地点的入口和出口位置。

JSON 表示法
{
  "location": {
    object (LatLng)
  },
  "tags": [
    enum (Entrance.Tag)
  ],
  "place": string
}
字段
location

object (LatLng)

入口的位置。

tags[]

enum (Entrance.Tag)

描述入口的标记列表。

place

string

入口所在的实体的结构,采用 places/{placeId} 格式。

Entrance.Tag

描述入口的特征。

枚举
TAG_UNSPECIFIED 未使用。
PREFERRED

入口可能提供对返回的目的地中主要地点的实际访问权限。一个地点可以有多个首选入口。如果某个入口没有此标记,则表示该入口在实体上与主要场所位于同一建筑物内,但不一定能通往该场所。

例如,如果主要地点是商业街中的一家餐厅,“首选”入口很可能是通往餐厅本身的入口,而返回的其他入口则是该建筑物的其他入口,例如通往商业街中其他餐厅的入口。

如果主要地点本身就是建筑物,则 PREFERRED 入口将是通往建筑物“主要”部分的入口。例如,在购物中心内,PREFERRED 入口是可通往主门厅区域的入口,但如果某个入口仅可通往建筑物侧面的商店,则该入口不是 PREFERRED 入口。

注意:PREFERRED 入口可能无法通往主要地点,而非 PREFERRED 入口可能可以通往主要地点。