Method: geocode.location.geocodeLocation
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
此方法执行位置地理编码,即将 LatLng 映射到地址。它还提供有关地址的结构化信息。
HTTP 请求
GET https://geocode.googleapis.com/v4beta/geocode/location
网址采用 gRPC 转码语法。
查询参数
参数 |
languageCode |
string
可选。应返回结果所用的语言。
|
regionCode |
string
可选。区域代码。地区代码,以 ccTLD(“顶级域名”)双字符值的形式指定。此参数会根据适用法律影响结果。
|
types[] |
string
可选。一组用于限制结果的类型标记。系统会移除不属于任何指定类型的结果。 如需查看可能值的完整列表,请参阅 https://developers.google.com/maps/documentation/places/web-service/place-types 中的表 A 和表 B。
|
granularity[] |
enum (GeocodeResult.Granularity )
可选。一个或多个位置精细度枚举的过滤条件。
|
联合参数 location_input 。要进行地理编码的位置。location_input 只能是下列其中一项: |
locationQuery |
string
位置,采用“lat,lng”字符串格式。例如,“64.7611872,-18.4705364”。
|
location |
object (LatLng )
结构化格式的位置。
|
响应正文
如果成功,则响应正文包含一个 GeocodeLocationResponse
实例。
授权范围
需要以下 OAuth 范围之一:
https://www.googleapis.com/auth/cloud-platform
https://www.googleapis.com/auth/maps-platform.geocode
https://www.googleapis.com/auth/maps-platform.geocode.location
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[],[],null,["# Method: geocode.location.geocodeLocation\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n\nThis method performs a location geocode, which maps a LatLng to an address. It also provides structured information about the address.\n\n### HTTP request\n\n`GET https://geocode.googleapis.com/v4beta/geocode/location`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `languageCode` | `string` Optional. Language in which the results should be returned. |\n| `regionCode` | `string` Optional. Region code. The region code, specified as a ccTLD (\"top-level domain\") two-character value. The parameter affects results based on applicable law. |\n| `types[]` | `string` Optional. A set of type tags to restrict the results. Results that do not have any of the specified types are removed. For the complete list of possible values, see Table A and Table B at \u003chttps://developers.google.com/maps/documentation/places/web-service/place-types\u003e. |\n| `granularity[]` | `enum (`[GeocodeResult.Granularity](/maps/documentation/geocoding/reference/rest/v4beta/GeocodeResult.Granularity)`)` Optional. A filter of one or more location granularity enums. |\n| Union parameter `location_input`. The location to geocode. `location_input` can be only one of the following: ||\n| `locationQuery` | `string` The location in the format of \"lat,lng\" string. For example, \"64.7611872,-18.4705364\". |\n| `location` | `object (`[LatLng](/maps/documentation/geocoding/reference/rest/Shared.Types/LatLng)`)` The location in the structured format. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body contains an instance of [GeocodeLocationResponse](/maps/documentation/geocoding/reference/rest/v4beta/GeocodeLocationResponse).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/cloud-platform`\n- `\n https://www.googleapis.com/auth/maps-platform.geocode`\n- `\n https://www.googleapis.com/auth/maps-platform.geocode.location`"]]