如果您使用 Geocoding API v3 取得上述功能,請參閱本文,改用 SearchDestinations 端點取得這些功能。本文說明如何在 SearchDestinations API 回應中找到這些功能,以及 Geocoding API v3 和 Geocoding API v4 的 SearchDestinations 端點,在 API 回應中呈現這些功能時的差異。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[],[],null,["# Migrate from v3 features to the SearchDestinations endpoint\n\n\u003cbr /\u003e\n\n| This product or feature is Experimental (pre-GA). Pre-GA products and features might have limited support, and changes to pre-GA products and features might not be compatible with other pre-GA versions. Pre-GA Offerings are covered by the [Google\n| Maps Platform Service Specific Terms](https://cloud.google.com/maps-platform/terms/maps-service-terms). For more information, see the [launch stage descriptions](/maps/launch-stages).\n\n\u003cbr /\u003e\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\nThe following features in the Geocoding API v3 are being replaced by the\n[SearchDestinations](/maps/documentation/geocoding/search-for-destinations)\nendpoint of the Geocoding API v4:\n\n- Entrances\n- Navigation points\n- Building outlines\n- Grounds\n\nIf you were using the Geocoding API v3 for the above features, use this document\nto help you use the SearchDestinations endpoint instead to get these features.\nThis document explains where in the SearchDestinations API response to find\nthese features, and differences in how these features are represented in the API\nresponses between the Geocoding API v3 and the SearchDestinations endpoint of\nthe Geocoding API v4.\n\nEntrances\n---------\n\nTo get the entrances associated with a\n[`destination`](/maps/documentation/geocoding/reference/rest/v4alpha/geocode.destinations/searchDestinations#destination),\nuse the field `destination.entrances`.\n\nNote that the format of an\n[`entrance`](/maps/documentation/geocoding/reference/rest/v4alpha/geocode.destinations/searchDestinations#entrance)\nis slightly different from the\n[entrance format in the Geocoding API v3](/maps/documentation/geocoding/building-attributes).\nEach entrance in `destination.entrances` has the following fields:\n\n- `displayName` - this is a new optional field that will have a human readable name for the entrance, for example \"Gate B\".\n- `location` - this is a location of type [`LatLng`](/maps/documentation/geocoding/reference/rest/Shared.Types/LatLng), which is different from the format used in the Geocoding API v3.\n- `tags` - this is the same as the `tags` field of the entrances from the Geocoding API v3.\n- `place` - analogous to the `buildingPlaceId` field of the entrances from the Geocoding API v3. However, the Place ID in this field could be for a Place of any type, not necessarily just a building.\n\nNavigation points\n-----------------\n\nTo get the navigation points associated with a `destination`, use the field\n`destination.navigationPoints`.\n\nNote that the format of a\n[`navigationPoint`](/maps/documentation/geocoding/reference/rest/v4alpha/geocode.destinations/searchDestinations#navigationpoint)\nis slightly different from the\n[navigation point format in the Geocoding API v3](/maps/documentation/geocoding/navigation-points).\nEach navigation point in `destination.navigationPoints` has the following\nfields:\n\n- `displayName` - this is a new optional field that will have a human readable name for the navigation point, for example \"5th Ave\".\n- `location` - this is a location of type [`LatLng`](/maps/documentation/geocoding/reference/rest/Shared.Types/LatLng), which is different from the format used in the Geocoding API v3.\n- `travelModes` - this is similar to the `restrictedTravelModes` field of the navigation points from the Geocoding API v3. The possible enum values are the same, the only difference is that this field now represents the acceptable travel modes for the navigation point, rather than the restricted travel modes.\n- `usage` - this is a new field which contains the use cases supported by the navigation point. Note that most navigation points will have an `UNKNOWN` usage, but that does not necessarily mean the navigation point's usage is restricted in any way.\n\nBuilding outlines\n-----------------\n\nTo get the building outlines associated with a `destination`, you should\nuse the `displayPolygon` field of the\n[`placeView`](/maps/documentation/geocoding/reference/rest/v4alpha/geocode.destinations/searchDestinations#placeview)\nobjects in the `destination` that represent buildings. For each `placeView`,\nyou can check if it is a building with the\n[`placeView.structureType`](/maps/documentation/geocoding/reference/rest/v4alpha/geocode.destinations/searchDestinations#placeview.structuretype)\nfield. If the structure type is `BUILDING`, you can get the outline from the\n`placeView.displayPolygon` field. The `placeView` will also have additional\nfields for the building that were not in the Geocoding API v3.\n\nA `destination` can have a `placeView` object that represents a building in the\nfollowing fields:\n\n- `destination.primary` - this is the primary place for the destination.\n- `destination.containingPlaces` - this is a repeated field that can hold larger places that \"contain\" the primary place. For example, if the primary place is a `subpremise`, `containingPlaces` will usually hold the `placeView` representing the building.\n- `destination.subDestinations` - this is a repeated field that can hold sub-destinations of the primary place. For example, individual apartment units of a building. This field won't typically have a `placeView` representing a building.\n\nNote that the format of `placeView.displayPolygon` matches the\n[building outline format in the Geocoding API v3](/maps/documentation/geocoding/building-attributes),\nwhich is the GeoJSON format, using the\n[RFC 7946 format](https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6).\n\nGrounds\n-------\n\nSimilar to building outlines, to get the grounds associated with a\n`destination`, you should use the `displayPolygon` field of the `placeView`\nobjects in the `destination` that represent grounds. For each `placeView`, you\ncan check if it is a grounds with the `placeView.structureType` field. If the\nstructure type is `GROUNDS`, you can get the outline from the\n`placeView.displayPolygon` field. The `placeView` will also have additional\nfields for the grounds that were not in the Geocoding API v3.\n\nA `destination` can have a `placeView` object that represents a grounds in the\nfollowing fields:\n\n- `destination.primary`\n- `destination.containingPlaces`\n- `destination.subDestinations`\n\nNote that the format of `placeView.displayPolygon` matches the\n[grounds outline format in the Geocoding API v3](/maps/documentation/geocoding/grounds),\nwhich is the GeoJSON format, using the\n[RFC 7946 format](https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6).\n\nUse a field mask to request these features\n------------------------------------------\n\nThe [SearchDestinations](/maps/documentation/geocoding/search-for-destinations)\nendpoint requires a field mask, as explained in\n[Choose fields to return](/maps/documentation/geocoding/choose-fields). The\nfield mask can be set to `*` in order to return all fields, or you can set it to\nthe specific fields you want to receive. For example, the following API request\nsets the field mask to receive all fields required to get the entrances,\nnavigation points, building outlines, and grounds of a destination: \n\n```curl\ncurl -X POST -d '{\"place\": \"places/ChIJG3kh4hq6j4AR_XuFQnV0_t8\"}' \\\n -H \"X-Goog-Api-Key: API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"X-Goog-FieldMask: destinations.entrances,destinations.navigationPoints,destinations.primary,destinations.containingPlaces,destinations.subDestinations\" \\\n https://geocode.googleapis.com/v4alpha/geocode/destinations\n```"]]