Geocoding API 的 SearchDestinations 方法现在包含目的地的详细停车信息。这些数据可通过以下方式帮助用户规划行程:
- 了解抵达后可使用的停车设施。
- 评估需要预留多少时间来寻找停车位。
请求停车信息
如需接收停车信息,您必须在请求的字段掩码中添加 destinations.parkingOptions。使用 X-Goog-FieldMask 标头指定您希望在响应中包含的字段。
cURL 请求示例
curl -X POST -d '{
"place": "places/ChIJcWnnWiz0wokRCB6aVdnDQEk"
}' \
-H 'Content-Type: application/json' \
-H "X-Goog-Api-Key: API_KEY" \
-H "X-Goog-FieldMask: destinations.primary.place,destinations.parkingOptions" \
https://geocode.googleapis.com/v4alpha/geocode/destinations
了解响应
如果请求,响应中的 Destination 对象将包含 parkingOptions 字段。
parkingOptions
此对象包含有关目的地停车情况的详细信息。
停车位类型:布尔值标志,用于指示特定停车位类型的可用性:
onsiteParking:如果目的地有现场停车位,则为 True。freeParkingLot:如果提供免费停车场,则为 true。paidParkingLot:如果提供付费停车场,则为 True。freeStreetParking:如果提供免费路边停车,则为 true。paidStreetParking:如果提供付费路边停车,则为 True。valetParking:如果提供代客泊车服务,则为 true。freeGarageParking:如果提供免费车库停车位,则为 True。paidGarageParking:如果提供收费车库停车位,则为 True。
Availability:一个枚举,用于指示寻找停车位的总体难度:
AVAILABILITY_UNSPECIFIED:停车位信息不可用。PLENTY:通常很容易找到停车位。SOMEWHAT_DIFFICULT:找停车位可能很困难。DIFFICULT:通常很难找到停车位。
停车设施 (
parkingFacilities):ParkingFacility对象的列表,表示与目的地关联的各个独立停车选项(例如特定的停车库或停车场):place:一个PlaceView,表示特定停车设施(包括其place、placeId、displayName、location、formattedAddress和displayPolygon)。onsite:如果停车设施位于主要目的地,则为 True。popular:如果停车设施是前往主要目的地的游客的热门选择,则为 True。straightLineDistanceMeters:从主要目的地到此停车设施的直线距离(以米为单位)。
响应代码段示例
{
"destinations": [
{
"primary": {
"place": "places/ChIJcWnnWiz0wokRCB6aVdnDQEk",
"displayName": {
"text": "Yankee Stadium",
"languageCode": "en"
}
// ... other primary place fields
},
"parkingOptions": {
"paidParkingLot": true,
"freeStreetParking": true,
"paidStreetParking": true,
"paidGarageParking": true,
"onsiteParking": true,
"parkingFacilities": [
{
"place": {
"place": "places/ChIJ8TdM8y70wokRToHbbtCEthQ",
"placeId": "ChIJ8TdM8y70wokRToHbbtCEthQ",
"displayName": {
"text": "164th St Parking Garage",
"languageCode": "en"
},
"primaryType": "parking_garage",
"formattedAddress": "164th St Parking Garage, 65 W 164th St, Bronx, NY 10452, USA",
"structureType": "POINT",
"location": {
"latitude": 40.830543999999996,
"longitude": -73.924656
}
// ... other place fields
},
"onsite": true,
"popular": false
},
{
"place": {
"place": "places/ChIJ-zvoYG71wokRElYeJWoI9GY",
"placeId": "ChIJ-zvoYG71wokRElYeJWoI9GY",
"displayName": {
"text": "River Ave. Parking Garage",
"languageCode": "en"
},
"primaryType": "parking_garage",
"formattedAddress": "River Ave. Parking Garage, 999-943 River Ave, Bronx, NY 10452, USA",
"structureType": "POINT",
"location": {
"latitude": 40.8298561,
"longitude": -73.9245919
}
// ... other place fields
},
"onsite": false,
"popular": false,
"straightLineDistanceMeters": 12.754842758178711
}
// ... other parking facilities
]
}
// ... other destination fields
}
]
}
反馈
这是 Geocoding API 的一项实验性功能。欢迎您通过 geocoding-feedback-channel@google.com 提供反馈。