<?php
require_once 'curl.func.php';
$appkey = 'your_appkey_here';//你的appkey
$lat = '30.2812129803';
$lng = '120.11523398';
$type='baidu';//可选 google baidu
$url = "https://api.jisuapi.com/geoconvert/coord2addr?appkey=$appkey&lat=$lat&lng=$lng&type=$type";
$result = curlOpen($url, ['ssl'=>true]);
$jsonarr = json_decode($result, true);
//exit(var_dump($jsonarr));
if($jsonarr['status'] != 0)
{
echo $jsonarr['msg'];
exit();
}
$result = $jsonarr['result'];
echo $result['lat'].' '.$result['lng'].' '.$result['type'].' '.$result['address'].'
';
echo $result['country'].' '.$result['province'].' '.$result['city'].' '.$result['district'].' '.$result['description'].'
';
#!/usr/bin/python
# encoding:utf-8
import requests
# 1、经纬度转地址
data = {}
data["appkey"] = "your_appkey_here"
data["lat"] = "30.2812129803"
data["lng"] = "120.11523398"
data["type"] = "baidu" #可选 google baidu
url = "https://api.jisuapi.com/geoconvert/coord2addr"
response = requests.get(url,params=data)
jsonarr = response.json()
if jsonarr["status"] != 0:
print(jsonarr["msg"])
exit()
result = jsonarr["result"]
print(result["lat"],result["lng"],result["type"],result["address"])
print(result["country"],result["province"],result["city"],result["district"],result["description"])
package api.jisuapi.geoconvert;
import api.util.HttpUtil;
import net.sf.json.JSONObject;
public class Coord2addr {
public static final String APPKEY = "your_appkey_here";// 你的appkey
public static final String URL = "https://api.jisuapi.com/geoconvert/coord2addr";
public static final String lat = "30.2812129803";
public static final String lng = "120.11523398";
public static final String type = "baidu";//可选 google baidu
public static void Get() {
String result = null;
String url = URL + "?lat=" + lat + "&lng=" + lng + "&type=" + type + "&appkey=" + APPKEY;
try {
result = HttpUtil.sendGet(url, "utf-8");
JSONObject json = JSONObject.fromObject(result);
if (json.getInt("status") != 0) {
System.out.println(json.getString("msg"));
} else {
JSONObject resultarr = json.optJSONObject("result");
String lat = resultarr.getString("lat");
String lng = resultarr.getString("lng");
String type = resultarr.getString("type");
String address = resultarr.getString("address");
String country = resultarr.getString("country");
String province = resultarr.getString("province");
String city = resultarr.getString("city");
String district = resultarr.getString("district");
String description = resultarr.getString("description");
System.out.println(lat + " " + lng + " " + type + " " + address + " " + country + " " + province + " "
+ city + " " + district + " " + description);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
// 1. 安装 axios(如果未安装)
// 在终端执行: npm install axios
const axios = require('axios');
// 2. 直接配置参数
const url = 'https://api.jisuapi.com/geoconvert/coord2addr';
const params = {
appkey: 'your_appkey_here', // 替换成你的真实appkey
lat: '30.2812129803',
lng: '120.11523398',
type: 'baidu'
};
// 3. 立即发送请求
axios.get(url, { params })
.then(response => {
// 检查API业务状态码
if (response.data.status !== 0) {
console.error('API返回错误:', response.data.status+"-"+response.data.msg);
return;
}
// 输出结果
for (const [key, value] of Object.entries(response.data.result)) {
console.log(`${key.padEnd(8)}:`, value);
}
})
.catch(error => {
// 统一错误处理
console.error('请求失败!');
});