Home > Backend Development > PHP Tutorial > Convert the longitude and latitude of Baidu map to the corresponding longitude and latitude of Tencent Map/Google, longitude and latitude google_PHP tutorial

Convert the longitude and latitude of Baidu map to the corresponding longitude and latitude of Tencent Map/Google, longitude and latitude google_PHP tutorial

WBOY
Release: 2016-07-13 09:44:22
Original
1687 people have browsed it

Convert the longitude and latitude of Baidu Map to the corresponding longitude and latitude of Tencent Map/Google, and the longitude and latitude of google

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);
}
Copy after login

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 , points=latitude and longitude, just pass it into Baidu:

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1049116.htmlTechArticleConvert the longitude and latitude of Baidu map to the corresponding longitude and latitude of Tencent Map/Google, the longitude and latitude of google. Purpose: Convert the longitude and latitude of Baidu map to Longitude and latitude corresponding to Tencent Map/Google. Method...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template