900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > android:高德sdk将gps小数点后6位的定位转小数点后12位的经纬度

android:高德sdk将gps小数点后6位的定位转小数点后12位的经纬度

时间:2019-11-10 15:10:05

相关推荐

android:高德sdk将gps小数点后6位的定位转小数点后12位的经纬度

为什么会有这篇文章

因为前一篇/title71/article/details/115064924

这个方法突然失效了,没办法,得看看,高德有没有提供,刚好,可以直接转换,挺方便

public AMapLocation fromGpsToAmap() {Location location = LocationUtils.getInstance(uploadService.this).showLocation();AMapLocation aMapLocation = new AMapLocation(location);CoordinateConverter converter = new CoordinateConverter(mContext);converter.from(CoordinateConverter.CoordType.GPS);try {converter.coord(new DPoint(location.getLatitude(), location.getLongitude()));DPoint desLatLng = converter.convert();aMapLocation.setLatitude(desLatLng.getLatitude());aMapLocation.setLongitude(desLatLng.getLongitude());} catch (Exception e) {e.printStackTrace();}return aMapLocation;}

调用

address = fromGpsToAmap(location).getLongitude()+","+fromGpsToAmap(location).getLatitude();

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。