导航点
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
地理编码响应中的 navigation_points
字段包含一个点列表,这些点有助于前往相应地点。具体而言,在道路网络上从该地点出发或前往该地点时,它们应作为起点或终点使用。每个导航点都包含以下值:
location
包含导航点的纬度和经度值。此位置始终非常靠近道路网络,是前往或离开某个地点的理想停靠点或起点。该点有意略微偏离道路中心线,以便清楚地标记出相应地点所在的道路一侧。
restricted_travel_modes
是导航点无法通过以下出行方式到达的列表:
"DRIVE"
是与驾车路线对应的出行方式。
"WALK"
是与步行路线对应的出行方式。
road_name
包含导航点所偏移的道路的名称。
对于大多数具有确切位置(例如街道地址、建筑物和商家)的地点,系统都会返回导航点。如果某个地点代表的是城市和地区等大面积区域,其确切位置可能不明确,那么系统可能不会返回任何导航点。
迁移通知
自 4 月 17 日起,您现在必须在请求中提供 NAVIGATION_POINTS
额外计算参数,才能接收导航点。客户端可以通过确认以下内容来测试此功能:某些导航点中的 road_name
字段是否已返回,以及每个导航点中的 location
字段是否包含以下四个子字段(lat
、lng
、latitude
、longitude
)。
此外,您还必须迁移到 location.lat
和 location.lng
字段,而不是 location.latitude
和 location.longitude
字段。在未来的版本中,不包含 NAVIGATION_POINTS
额外计算参数的请求将不会在响应中包含任何导航点,并且不再返回 location.latitude
和 location.longitude
字段。
请求详情
您可以在以下类型的请求中获取导航点:
对于上述任何请求,您都需要提供以下参数:extra_computations=NAVIGATION_POINTS
。
示例请求
以下查询使用地点地理编码来获取美国加利福尼亚州山景城一家餐厅的导航点:
https://maps.googleapis.com/maps/api/geocode/json?place_id=ChIJZ54APTS3j4ARBYZD956MHq8&extra_computations=NAVIGATION_POINTS&key=YOUR_API_KEY
示例响应
上述查询的响应显示了一个导航点数组:
{
"navigation_points": [
{
"location": {
"lat": 37.3940894,
"lng": -122.0788389,
},
"restricted_travel_modes": ["WALK"],
"road_name": "Castro Street"
},
{
"location": {
"lat": 37.394273,
"lng": -122.0793078,
},
"restricted_travel_modes": ["WALK"],
"road_name": "Wild Cherry Lane"
},
{
"location": {
"lat": 37.3941202,
"lng": -122.0789189,
},
"restricted_travel_modes": ["DRIVE"]
}
]
}
反馈
这是一项实验性功能。欢迎发送电子邮件至 geocoding-feedback-channel@google.com 提供反馈。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[],[],null,["# Navigation points\n\n| **Important:** This experimental feature has been replaced by the [SearchDestinations](/maps/documentation/geocoding/search-for-destinations) endpoint of the new Geocoding API v4. Use that endpoint instead if you want to get the navigation points of a place.\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 `navigation_points` field within the Geocoding response contains a list of\npoints that are useful for navigating to the place. Specifically, they should be\nused either as the starting or ending points when routing on a road network from\nor to the place. Each navigation point contains the following values:\n\n- `location` contains the latitude, longitude value of the navigation point. This location will always be very close to the road network and represents an ideal stopping or starting point for navigating to and from a place. The point is intentionally slightly offset from the road's centerline to clearly mark the side of the road where the place is located.\n- `restricted_travel_modes` is a list of travel modes that the navigation point is not accessible from:\n - `\"DRIVE\"` is the travel mode corresponding to driving directions.\n - `\"WALK\"` is the travel mode corresponding to walking directions.\n- `road_name` contains the name of the road the navigation point is offset from.\n\n\u003cbr /\u003e\n\nNavigation points are returned for most places with a precise location, such as\nstreet addresses, buildings, and establishments. Places that represent large\nareas, such as cities and regions, where a precise location can be ambiguous\nmight not return any navigation points.\n\nMigration notice\n----------------\n\nStarting April 17th, you must now supply the `NAVIGATION_POINTS` extra\ncomputations parameter in the request to receive navigation points. Clients can\ntest this by confirming that the `road_name` field within some navigation points\nis returned and that the `location` field within each navigation point has the\nfollowing four subfields (`lat`, `lng`, `latitude`, `longitude`).\n\nAdditionally, you must migrate to the `location.lat` and `location.lng` fields\nrather than the `location.latitude` and `location.longitude` fields. In a future\nrelease, requests that don't contain the `NAVIGATION_POINTS` extra computations\nparameter won't include any navigation points in the response and the\n`location.latitude` and `location.longitude` fields will no longer be returned.\n\nRequest details\n---------------\n\nYou can obtain navigation points in the following kinds of requests:\n\n- [Geocoding request](/maps/documentation/geocoding/requests-geocoding)\n- [Reverse geocoding request](/maps/documentation/geocoding/requests-reverse-geocoding)\n- [Place geocoding request](/maps/documentation/geocoding/requests-places-geocoding)\n\nFor any of these requests, you supply this parameter:\n`extra_computations=NAVIGATION_POINTS`.\n\n### Example request\n\nThe following query uses [place geocoding](/maps/documentation/geocoding/requests-places-geocoding) to obtain navigation points for a\nrestaurant in Mountain View, California, United States: \n\n https://maps.googleapis.com/maps/api/geocode/json?place_id=ChIJZ54APTS3j4ARBYZD956MHq8&extra_computations=NAVIGATION_POINTS&key=YOUR_API_KEY\n\n### Example response\n\nThe response from the query above shows an array of navigation points: \n\n {\n \"navigation_points\": [\n {\n \"location\": {\n \"lat\": 37.3940894,\n \"lng\": -122.0788389,\n },\n \"restricted_travel_modes\": [\"WALK\"],\n \"road_name\": \"Castro Street\"\n },\n {\n \"location\": {\n \"lat\": 37.394273,\n \"lng\": -122.0793078,\n },\n \"restricted_travel_modes\": [\"WALK\"],\n \"road_name\": \"Wild Cherry Lane\"\n },\n {\n \"location\": {\n \"lat\": 37.3941202,\n \"lng\": -122.0789189,\n },\n \"restricted_travel_modes\": [\"DRIVE\"]\n }\n ]\n }\n\nFeedback\n--------\n\nThis is an experimental feature. We would appreciate feedback at\n[geocoding-feedback-channel@google.com](mailto:geocoding-feedback-channel@google.com)."]]