GPS坐标与高德坐标相互转换

GPS坐标转高德坐标:

GPS转高德坐标方法高德API已经提供。

导包:

import com.amap.api.maps.model.LatLng;
import com.amap.api.maps.CoordinateConverter;
import com.amap.api.maps.CoordinateConverter.CoordType;

代码转换:

LatLng latLng= new LatLng(gps[1], gps[0]);
CoordinateConverter converter = new CoordinateConverter(this);
// CoordType.GPS 待转换坐标类型
converter.from(CoordType.GPS);
// 转换
converter.coord(latLng);
// 获取转换之后的高德坐标
LatLng result = converter.convert();

高德坐标转GPS坐标:

高德坐标转GPS坐标时,大部分人都会遇到误差问题,(网上的一些资料转换误差比较大,不能满足实际使用。后来经过修改后反复测试,误差可以控制在0.2米左右)经过实践验证是可以的。

导包:

import com.amap.api.ser
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值