ดูข้อมูลที่จอดรถ

นักพัฒนาซอฟต์แวร์ในเขตเศรษฐกิจยุโรป (EEA)

ตอนนี้เมธอด 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