📖 使用指南
🚀 快速开始
使用方法:只需两个步骤即可使用我们的代理服务
步骤 1: 将域名
步骤 2: 使用我们分配的 API Key(或使用调试 Key:
💡 发送邮件至
maps.googleapis.com 替换为 当前域名步骤 2: 使用我们分配的 API Key(或使用调试 Key:
DEBUG_KEY_FOR_TESTING)
💡 发送邮件至
contact@aeio.dev 申请正式 API Key
# Google 官方文档中的示例
https://maps.googleapis.com/maps/api/geocode/json?address=北京市&key=YOUR_API_KEY
# 通过我们的代理访问(使用当前域名)
https://当前域名/maps/api/geocode/json?address=北京市&key=YOUR_ASSIGNED_KEY
# 或使用调试 Key 测试
https://当前域名/maps/api/geocode/json?address=北京市&key=DEBUG_KEY_FOR_TESTING
https://maps.googleapis.com/maps/api/geocode/json?address=北京市&key=YOUR_API_KEY
# 通过我们的代理访问(使用当前域名)
https://当前域名/maps/api/geocode/json?address=北京市&key=YOUR_ASSIGNED_KEY
# 或使用调试 Key 测试
https://当前域名/maps/api/geocode/json?address=北京市&key=DEBUG_KEY_FOR_TESTING
💡 注意:直接使用当前访问的域名即可,无需修改端口号
🔑 API Key 使用
🔧 申请正式 Key
发送邮件至
发送邮件至
contact@aeio.dev 申请正式 API Key
🧪 使用调试 Key
使用
使用
DEBUG_KEY_FOR_TESTING 进行功能验证和测试。调试 Key 仅用于开发测试,有频率限制,生产环境请申请正式 Key
💡 推荐:为了获得稳定的服务体验和更高的请求限额,建议申请正式 API Key。
💡 所有参数和使用方法与 Google 官方 API 完全兼容
🔧 API 调试工具
选择一个 API 类型,然后输入参数进行测试:
🚀 快速示例
点击下方按钮快速测试常用 API:
📝 代码示例
Python 示例
import requests
# 地址转坐标
response = requests.get(
"https://YOUR_DOMAIN/maps/api/geocode/json",
params={"address": "北京市天安门广场", "key": "DEBUG_KEY_FOR_TESTING"}
)
print(response.json())
# 路线规划
response = requests.get(
"https://YOUR_DOMAIN/maps/api/directions/json",
params={"origin": "北京市", "destination": "上海市", "key": "DEBUG_KEY_FOR_TESTING"}
)
print(response.json())
JavaScript (Node.js) 示例
// 地址转坐标
const response = await fetch(
'https://YOUR_DOMAIN/maps/api/geocode/json?address=北京市天安门广场&key=DEBUG_KEY_FOR_TESTING'
);
const data = await response.json();
console.log(data);
// 地点搜索
const placesResponse = await fetch(
'https://YOUR_DOMAIN/maps/api/place/nearbysearch/json?location=39.908722,116.397498&radius=1000&type=restaurant&key=DEBUG_KEY_FOR_TESTING'
);
const placesData = await placesResponse.json();
console.log(placesData);
Java 示例
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
// 地址转坐标
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://YOUR_DOMAIN/maps/api/geocode/json?address=北京市天安门广场&key=DEBUG_KEY_FOR_TESTING"))
.build();
HttpResponse response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Go 示例
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
// 地址转坐标
resp, err := http.Get("https://YOUR_DOMAIN/maps/api/geocode/json?address=北京市天安门广场&key=DEBUG_KEY_FOR_TESTING")
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
curl 示例
# 地址转坐标
curl "https://YOUR_DOMAIN/maps/api/geocode/json?address=北京市天安门广场&key=DEBUG_KEY_FOR_TESTING"
# 路线规划
curl "https://YOUR_DOMAIN/maps/api/directions/json?origin=北京市&destination=上海市&key=DEBUG_KEY_FOR_TESTING"
# 地点搜索
curl "https://YOUR_DOMAIN/maps/api/place/nearbysearch/json?location=39.908722,116.397498&radius=1000&type=restaurant&key=DEBUG_KEY_FOR_TESTING"
# 静态地图
curl "https://YOUR_DOMAIN/maps/api/staticmap?center=Beijing&zoom=12&size=600x400&key=DEBUG_KEY_FOR_TESTING"
PHP 示例
'北京市天安门广场',
'key' => 'DEBUG_KEY_FOR_TESTING'
];
$response = file_get_contents($url . '?' . http_build_query($params));
$data = json_decode($response, true);
print_r($data);
?>
💡 提示:请将 YOUR_DOMAIN 替换为实际的访问域名