GPS坐标转换为百度坐标的方法

来源:互联网 发布:php替换字符串中一部分 编辑:程序博客网 时间:2024/04/30 07:09

            //原始GPS坐标

            GeoPoint point = new GeoPoint((int) (location.getLatitude() * 1E6), (int) (location.getLongitude() * 1E6));    

            Toast.makeText(this, location.getLatitude()+" "+location.getLongitude(), Toast.LENGTH_SHORT).show();
            
            //坐标转换
            point= CoordinateConvert.fromWgs84ToBaidu(point);
            //修改坐标
            location.setLatitude(point.getLatitudeE6()/1E6);
            location.setLongitude(point.getLongitudeE6()/1E6);
            Toast.makeText(this, location.getLatitude()+" "+location.getLongitude(), Toast.LENGTH_SHORT).show();
0 0
原创粉丝点击