更新记录
1.0.0(2025-10-10) 下载此版本
逆地理编码解析,从经纬度获得地理信息,传入经纬度值,返回精确到道路级别的地理信息
平台兼容性
uni-app(4.53)
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | √ | √ | √ | √ | √ | √ | √ | √ |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
√ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |
介绍
本功能基于轻语API 轻语API提供一键生成二维码、OCR文字识别、文字转语音、随机图库、智能Ai助手、地理编码获取(逆地理编码,从内容中获取地址信息(含经纬度),从经纬度获取地址信息)等等API
// 查询逆地理编码
onQuery() {
let that = this;
// 验证输入
if(!that.latitude || !that.longitude) {
uni.showToast({
title: '请输入经纬度',
icon: 'none'
});
return;
}
that.status = 'loading';
that.resultText = '';
// 生成完整的请求URL
const baseUrl = 'https://5555api.com/data/api/reverseGeocoder';
that.requestUrl = `${baseUrl}?latitude=${that.latitude}&longitude=${that.longitude}&apikey=test_app_key_5555api.com`;
uni.request({
method: 'GET',
url: baseUrl,
data: {
latitude: that.latitude,
longitude: that.longitude,
apikey: 'test_app_key_5555api.com'
},
timeout: 15000,
success(res) {
that.status = '';
console.log('请求成功:', res);
if(res.data) {
// 格式化显示结果
that.resultText = JSON.stringify(res.data, null, 2);
} else {
that.resultText = "查询成功,但未返回数据";
}
},
fail(err) {
that.status = '';
console.error('请求失败:', err);
that.resultText = "服务异常:" + (err.errMsg || '网络请求失败');
uni.showToast({
title: '请求失败',
icon: 'none'
});
}
})
}