Geocoding API
curl --request POST \
--url https://api.aisa.one/apis/v1/google-maps/geocoding-api \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"address": "1600 Amphitheatre Parkway, Mountain View, CA",
"bounds": "34.172684,-118.604794|34.236144,-118.500938",
"components": "postal_code:94043|country:US",
"extra_computations": [
"ADDRESS_DESCRIPTORS"
],
"key": "YOUR_API_KEY",
"language": "en",
"latlng": "40.714224,-73.961452",
"location_type": "ROOFTOP|RANGE_INTERPOLATED",
"place_id": "ChIJd8BlQ2BZwokRAFUEcm_qrcA",
"region": "US",
"result_type": "street_address|locality"
}
'import requests
url = "https://api.aisa.one/apis/v1/google-maps/geocoding-api"
payload = {
"address": "1600 Amphitheatre Parkway, Mountain View, CA",
"bounds": "34.172684,-118.604794|34.236144,-118.500938",
"components": "postal_code:94043|country:US",
"extra_computations": ["ADDRESS_DESCRIPTORS"],
"key": "YOUR_API_KEY",
"language": "en",
"latlng": "40.714224,-73.961452",
"location_type": "ROOFTOP|RANGE_INTERPOLATED",
"place_id": "ChIJd8BlQ2BZwokRAFUEcm_qrcA",
"region": "US",
"result_type": "street_address|locality"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
address: '1600 Amphitheatre Parkway, Mountain View, CA',
bounds: '34.172684,-118.604794|34.236144,-118.500938',
components: 'postal_code:94043|country:US',
extra_computations: ['ADDRESS_DESCRIPTORS'],
key: 'YOUR_API_KEY',
language: 'en',
latlng: '40.714224,-73.961452',
location_type: 'ROOFTOP|RANGE_INTERPOLATED',
place_id: 'ChIJd8BlQ2BZwokRAFUEcm_qrcA',
region: 'US',
result_type: 'street_address|locality'
})
};
fetch('https://api.aisa.one/apis/v1/google-maps/geocoding-api', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/google-maps/geocoding-api",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'address' => '1600 Amphitheatre Parkway, Mountain View, CA',
'bounds' => '34.172684,-118.604794|34.236144,-118.500938',
'components' => 'postal_code:94043|country:US',
'extra_computations' => [
'ADDRESS_DESCRIPTORS'
],
'key' => 'YOUR_API_KEY',
'language' => 'en',
'latlng' => '40.714224,-73.961452',
'location_type' => 'ROOFTOP|RANGE_INTERPOLATED',
'place_id' => 'ChIJd8BlQ2BZwokRAFUEcm_qrcA',
'region' => 'US',
'result_type' => 'street_address|locality'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/google-maps/geocoding-api"
payload := strings.NewReader("{\n \"address\": \"1600 Amphitheatre Parkway, Mountain View, CA\",\n \"bounds\": \"34.172684,-118.604794|34.236144,-118.500938\",\n \"components\": \"postal_code:94043|country:US\",\n \"extra_computations\": [\n \"ADDRESS_DESCRIPTORS\"\n ],\n \"key\": \"YOUR_API_KEY\",\n \"language\": \"en\",\n \"latlng\": \"40.714224,-73.961452\",\n \"location_type\": \"ROOFTOP|RANGE_INTERPOLATED\",\n \"place_id\": \"ChIJd8BlQ2BZwokRAFUEcm_qrcA\",\n \"region\": \"US\",\n \"result_type\": \"street_address|locality\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/google-maps/geocoding-api")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"1600 Amphitheatre Parkway, Mountain View, CA\",\n \"bounds\": \"34.172684,-118.604794|34.236144,-118.500938\",\n \"components\": \"postal_code:94043|country:US\",\n \"extra_computations\": [\n \"ADDRESS_DESCRIPTORS\"\n ],\n \"key\": \"YOUR_API_KEY\",\n \"language\": \"en\",\n \"latlng\": \"40.714224,-73.961452\",\n \"location_type\": \"ROOFTOP|RANGE_INTERPOLATED\",\n \"place_id\": \"ChIJd8BlQ2BZwokRAFUEcm_qrcA\",\n \"region\": \"US\",\n \"result_type\": \"street_address|locality\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/google-maps/geocoding-api")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": \"1600 Amphitheatre Parkway, Mountain View, CA\",\n \"bounds\": \"34.172684,-118.604794|34.236144,-118.500938\",\n \"components\": \"postal_code:94043|country:US\",\n \"extra_computations\": [\n \"ADDRESS_DESCRIPTORS\"\n ],\n \"key\": \"YOUR_API_KEY\",\n \"language\": \"en\",\n \"latlng\": \"40.714224,-73.961452\",\n \"location_type\": \"ROOFTOP|RANGE_INTERPOLATED\",\n \"place_id\": \"ChIJd8BlQ2BZwokRAFUEcm_qrcA\",\n \"region\": \"US\",\n \"result_type\": \"street_address|locality\"\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"address_components": [
{
"long_name": "<string>",
"short_name": "<string>",
"types": [
"<string>"
]
}
],
"formatted_address": "<string>",
"geometry": {
"location": {
"lat": 123,
"lng": 123
},
"location_type": "<string>",
"viewport": {
"northeast": {
"lat": 123,
"lng": 123
},
"southwest": {
"lat": 123,
"lng": 123
}
},
"bounds": {
"northeast": {
"lat": 123,
"lng": 123
},
"southwest": {
"lat": 123,
"lng": 123
}
}
},
"place_id": "<string>",
"types": [
"<string>"
],
"partial_match": true,
"plus_code": {
"compound_code": "<string>",
"global_code": "<string>"
},
"postcode_localities": [
"<string>"
]
}
],
"status": "<string>",
"error_message": "<string>",
"plus_code": {
"compound_code": "<string>",
"global_code": "<string>"
}
}Google 地图
Geocoding API
Geocoding API
POST
https://api.aisa.one
/
apis
/
v1
/
google-maps
/
geocoding-api
Geocoding API
curl --request POST \
--url https://api.aisa.one/apis/v1/google-maps/geocoding-api \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"address": "1600 Amphitheatre Parkway, Mountain View, CA",
"bounds": "34.172684,-118.604794|34.236144,-118.500938",
"components": "postal_code:94043|country:US",
"extra_computations": [
"ADDRESS_DESCRIPTORS"
],
"key": "YOUR_API_KEY",
"language": "en",
"latlng": "40.714224,-73.961452",
"location_type": "ROOFTOP|RANGE_INTERPOLATED",
"place_id": "ChIJd8BlQ2BZwokRAFUEcm_qrcA",
"region": "US",
"result_type": "street_address|locality"
}
'import requests
url = "https://api.aisa.one/apis/v1/google-maps/geocoding-api"
payload = {
"address": "1600 Amphitheatre Parkway, Mountain View, CA",
"bounds": "34.172684,-118.604794|34.236144,-118.500938",
"components": "postal_code:94043|country:US",
"extra_computations": ["ADDRESS_DESCRIPTORS"],
"key": "YOUR_API_KEY",
"language": "en",
"latlng": "40.714224,-73.961452",
"location_type": "ROOFTOP|RANGE_INTERPOLATED",
"place_id": "ChIJd8BlQ2BZwokRAFUEcm_qrcA",
"region": "US",
"result_type": "street_address|locality"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
address: '1600 Amphitheatre Parkway, Mountain View, CA',
bounds: '34.172684,-118.604794|34.236144,-118.500938',
components: 'postal_code:94043|country:US',
extra_computations: ['ADDRESS_DESCRIPTORS'],
key: 'YOUR_API_KEY',
language: 'en',
latlng: '40.714224,-73.961452',
location_type: 'ROOFTOP|RANGE_INTERPOLATED',
place_id: 'ChIJd8BlQ2BZwokRAFUEcm_qrcA',
region: 'US',
result_type: 'street_address|locality'
})
};
fetch('https://api.aisa.one/apis/v1/google-maps/geocoding-api', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/google-maps/geocoding-api",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'address' => '1600 Amphitheatre Parkway, Mountain View, CA',
'bounds' => '34.172684,-118.604794|34.236144,-118.500938',
'components' => 'postal_code:94043|country:US',
'extra_computations' => [
'ADDRESS_DESCRIPTORS'
],
'key' => 'YOUR_API_KEY',
'language' => 'en',
'latlng' => '40.714224,-73.961452',
'location_type' => 'ROOFTOP|RANGE_INTERPOLATED',
'place_id' => 'ChIJd8BlQ2BZwokRAFUEcm_qrcA',
'region' => 'US',
'result_type' => 'street_address|locality'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/google-maps/geocoding-api"
payload := strings.NewReader("{\n \"address\": \"1600 Amphitheatre Parkway, Mountain View, CA\",\n \"bounds\": \"34.172684,-118.604794|34.236144,-118.500938\",\n \"components\": \"postal_code:94043|country:US\",\n \"extra_computations\": [\n \"ADDRESS_DESCRIPTORS\"\n ],\n \"key\": \"YOUR_API_KEY\",\n \"language\": \"en\",\n \"latlng\": \"40.714224,-73.961452\",\n \"location_type\": \"ROOFTOP|RANGE_INTERPOLATED\",\n \"place_id\": \"ChIJd8BlQ2BZwokRAFUEcm_qrcA\",\n \"region\": \"US\",\n \"result_type\": \"street_address|locality\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/google-maps/geocoding-api")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"1600 Amphitheatre Parkway, Mountain View, CA\",\n \"bounds\": \"34.172684,-118.604794|34.236144,-118.500938\",\n \"components\": \"postal_code:94043|country:US\",\n \"extra_computations\": [\n \"ADDRESS_DESCRIPTORS\"\n ],\n \"key\": \"YOUR_API_KEY\",\n \"language\": \"en\",\n \"latlng\": \"40.714224,-73.961452\",\n \"location_type\": \"ROOFTOP|RANGE_INTERPOLATED\",\n \"place_id\": \"ChIJd8BlQ2BZwokRAFUEcm_qrcA\",\n \"region\": \"US\",\n \"result_type\": \"street_address|locality\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/google-maps/geocoding-api")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": \"1600 Amphitheatre Parkway, Mountain View, CA\",\n \"bounds\": \"34.172684,-118.604794|34.236144,-118.500938\",\n \"components\": \"postal_code:94043|country:US\",\n \"extra_computations\": [\n \"ADDRESS_DESCRIPTORS\"\n ],\n \"key\": \"YOUR_API_KEY\",\n \"language\": \"en\",\n \"latlng\": \"40.714224,-73.961452\",\n \"location_type\": \"ROOFTOP|RANGE_INTERPOLATED\",\n \"place_id\": \"ChIJd8BlQ2BZwokRAFUEcm_qrcA\",\n \"region\": \"US\",\n \"result_type\": \"street_address|locality\"\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"address_components": [
{
"long_name": "<string>",
"short_name": "<string>",
"types": [
"<string>"
]
}
],
"formatted_address": "<string>",
"geometry": {
"location": {
"lat": 123,
"lng": 123
},
"location_type": "<string>",
"viewport": {
"northeast": {
"lat": 123,
"lng": 123
},
"southwest": {
"lat": 123,
"lng": 123
}
},
"bounds": {
"northeast": {
"lat": 123,
"lng": 123
},
"southwest": {
"lat": 123,
"lng": 123
}
}
},
"place_id": "<string>",
"types": [
"<string>"
],
"partial_match": true,
"plus_code": {
"compound_code": "<string>",
"global_code": "<string>"
},
"postcode_localities": [
"<string>"
]
}
],
"status": "<string>",
"error_message": "<string>",
"plus_code": {
"compound_code": "<string>",
"global_code": "<string>"
}
}请求规范
- 方法与路径: POST /apis/v1/google-maps/geocoding-api
- 可用状态: enabled
- 请求 URL 模板:
https://api.aisa.one/apis/v1/google-maps/geocoding-api
{
"operationId": "google-maps.geocoding-api",
"method": "POST",
"path": "/apis/v1/google-maps/geocoding-api",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"address": {
"description": "The street address or plus code that you want to geocode. Provide for geocoding (address to coordinates).",
"examples": [
"1600 Amphitheatre Parkway, Mountain View, CA"
],
"type": "string"
},
"bounds": {
"description": "The bounding box of the viewport within which to bias geocode results more prominently (e.g., '34.172684,-118.604794|34.236144,-118.500938'). This parameter will only influence, not fully restrict, results.",
"examples": [
"34.172684,-118.604794|34.236144,-118.500938"
],
"type": "string"
},
"components": {
"description": "A components filter with elements separated by a pipe (|). E.g., 'postal_code:94043|country:US'. Used for geocoding, can be restrictive or biasing. Supplying only `components` without `address` may return ZERO_RESULTS for some queries.",
"examples": [
"postal_code:94043|country:US"
],
"type": "string"
},
"extra_computations": {
"description": "Use this parameter to specify additional features in the response. Can select multiple values.",
"examples": [
[
"ADDRESS_DESCRIPTORS"
]
],
"items": {
"enum": [
"ADDRESS_DESCRIPTORS",
"BUILDING_AND_ENTRANCES"
],
"type": "string"
},
"type": "array"
},
"key": {
"description": "Your application's API key. If not provided, will be extracted from connection metadata.",
"examples": [
"YOUR_API_KEY"
],
"type": "string"
},
"language": {
"description": "The language in which to return results. If language is not supplied, the geocoder attempts to use the preferred language as specified in the Accept-Language header, or the native language of the domain from which the request is sent.",
"examples": [
"en",
"es"
],
"type": "string"
},
"latlng": {
"description": "The latitude and longitude coordinates specifying the location for which you want the closest, human-readable address (e.g., '40.714224,-73.961452'). Provide for reverse geocoding.",
"examples": [
"40.714224,-73.961452"
],
"type": "string"
},
"location_type": {
"description": "A filter of one or more location types, separated by a pipe (|) (e.g., 'ROOFTOP|RANGE_INTERPOLATED'). Used for reverse geocoding and place ID geocoding.",
"examples": [
"ROOFTOP|RANGE_INTERPOLATED"
],
"type": "string"
},
"place_id": {
"description": "The place ID of the place for which you wish to obtain the human-readable address. Provide for place ID geocoding.",
"examples": [
"ChIJd8BlQ2BZwokRAFUEcm_qrcA"
],
"type": "string"
},
"region": {
"description": "The region code, specified as a ccTLD ('top-level domain') two-character value. This parameter will only influence, not fully restrict, results from the geocoder.",
"examples": [
"US",
"ES"
],
"type": "string"
},
"result_type": {
"description": "A filter of one or more address types, separated by a pipe (|) (e.g., 'street_address|locality'). Used for reverse geocoding and place ID geocoding.",
"examples": [
"street_address|locality"
],
"type": "string"
}
},
"type": "object"
}
}
},
"required": false
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
费用与请求规则
按实际用量收费。 默认请求预估费用:$0.0053 USD。 最终费用以实际用量为准。 账户适用价格可能不同;支持报价的接口可按实际请求获取报价。授权
请求体
application/json