Purpose: Convert the longitude and latitude of Baidu Map to the corresponding longitude and latitude of Tencent Map/Google.
Method 1: Use code to convert
Existing problems: The error is large after conversion and it is basically unusable
public static void Convert_BD09_To_GCJ02(double lat, double lng) { double x_pi = Math. PI * 3000.0 / 180.0; double x = lng - 0.0065, y = lat - 0.006; double z = Math. sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi); double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi); lng = z * Math. cos(theta ); lat = z * Math. sin(theta ); System. out.println(lng); System. out.println(lat); }
Method 2:
This website provides conversion services, the coordinates are relatively accurate and available, and the background calls are not carefully studied
http://www.minigps.net/convert.html
Method 3:
Use Tencent Maps, see 1.html
for details
The address of the old version of Tencent Map: http://api.map.soso.com/doc_v2/example.html?sample-convertor-library#12map
Latest address: http://lbs.qq.com/javascript_v2/doc/convertor.html
Directly called address
http://apic.map.qq.com/translate/?type=3&points=114.041993,22.667204&output=jsonp&pf=jsapi&cb=qq.maps.__svcbi1x9al56.cbi1x9al9l0
Coordinate query address:
http://api.map.baidu.com/lbsapi/getpoint/
http://lbs.qq.com/javascript_v2/case-run.html#sample-geocoding-reverse
Summary:
Since Tencent’s longitude and latitude are in the same coordinate system as Google’s longitude and latitude, Baidu’s longitude and latitude is its own system. The algorithm codes currently searched on the Internet are not very accurate, so it is recommended to use the API provided by the map developer for conversion.