ตอนนี้เมธอด SearchDestinations ของ Geocoding API มีข้อมูลที่จอดรถโดยละเอียดสำหรับจุดหมายต่างๆ ข้อมูลนี้จะช่วยให้ผู้ใช้สามารถวางแผนการเดินทางได้โดยทำดังนี้
- การทำความเข้าใจว่ามีที่จอดรถแบบใดบ้างเมื่อเดินทางมาถึง
- ประเมินเวลาที่ต้องใช้ในการหาที่จอดรถ
ขอข้อมูลที่จอดรถ
หากต้องการรับข้อมูลที่จอดรถ คุณต้องระบุ
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: จริง หากมีที่จอดรถให้บริการที่จุดหมายfreeParkingLot: True หากมีที่จอดรถฟรีpaidParkingLot: True หากมีที่จอดรถแบบเสียค่าบริการfreeStreetParking: True หากมีที่จอดรถริมถนนฟรีpaidStreetParking: True หากมีที่จอดรถริมถนนแบบเสียเงินvaletParking: True หากมีบริการนำรถไปจอดให้freeGarageParking: True หากมีที่จอดรถในโรงรถฟรีpaidGarageParking: True หากมีที่จอดรถแบบเสียค่าบริการ
ความพร้อมให้บริการ: Enum ที่ระบุความยากง่ายโดยทั่วไปในการหาที่จอดรถ
AVAILABILITY_UNSPECIFIED: ไม่มีข้อมูลความพร้อมให้บริการที่จอดรถPLENTY: โดยปกติแล้วหาที่จอดรถได้ง่ายSOMEWHAT_DIFFICULT: การหาที่จอดรถอาจเป็นเรื่องยากDIFFICULT: มักหาที่จอดรถได้ยากมาก
ที่จอดรถ (
parkingFacilities): รายการออบเจ็กต์ParkingFacilityที่แสดงตัวเลือกที่จอดรถแต่ละรายการ (เช่น โรงจอดรถหรือลานจอดรถที่เฉพาะเจาะจง) ที่เชื่อมโยงกับจุดหมาย ดังนี้place:PlaceViewที่แสดงถึงสถานที่จอดรถที่เฉพาะเจาะจง (รวมถึงplace,placeId,displayName,location,formattedAddressและdisplayPolygon)onsite: จริง หากสถานที่จอดรถตั้งอยู่ในสถานที่ของจุดหมายปลายทางหลัก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