search
HomePHP LibrariesOther librariesConvert Tencent map longitude and latitude to Baidu map longitude and latitude PHP class
Convert Tencent map longitude and latitude to Baidu map longitude and latitude PHP class
<?php
function Convert_GCJ02_To_BD09($lat,$lng){
    $x_pi = 3.14159265358979324 * 3000.0 / 180.0;
    $x = $lng;
    $y = $lat;
    $z =sqrt($x * $x + $y * $y) + 0.00002 * sin($y * $x_pi);
    $theta = atan2($y, $x) + 0.000003 * cos($x * $x_pi);
    $lng = $z * cos($theta) + 0.0065;
    $lat = $z * sin($theta) + 0.006;
    return array('lng'=>$lng,'lat'=>$lat);
}
function Convert_BD09_To_GCJ02($lat,$lng){
    $x_pi = 3.14159265358979324 * 3000.0 / 180.0;
    $x = $lng - 0.0065;
    $y = $lat - 0.006;
    $z = sqrt($x * $x + $y * $y) - 0.00002 * sin($y * $x_pi);
    $theta = atan2($y, $x) - 0.000003 * cos($x * $x_pi);
    $lng = $z * cos($theta);
    $lat = $z * sin($theta);
    return array('lng'=>$lng,'lat'=>$lat);
}
?>

China's normal GCJ02 coordinates---->Baidu map BD09 coordinates

Tencent map also uses GCJ02 coordinates

@param double $lat latitude

@ param double $lng Longitude

Baidu map BD09 coordinates---->China normal GCJ02 coordinates

Tencent map also uses GCJ02 coordinates

@param double $lat latitude

@param double $lng longitude

@return array();



Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

PHP Tencent map longitude and latitude to Baidu map longitude and latitudePHP Tencent map longitude and latitude to Baidu map longitude and latitude

25Jul2016

PHP Tencent map longitude and latitude to Baidu map longitude and latitude

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

13Jul2016

The longitude and latitude of Baidu map are converted to the corresponding longitude and latitude of Tencent Map/Google, and the longitude and latitude of Google. Convert the longitude and latitude of Baidu Map to the corresponding longitude and latitude of Tencent Map/Google. The purpose of the longitude and latitude of Google is to convert the longitude and latitude of Baidu Map to the corresponding longitude and latitude of Tencent Map/Google. Method

PHP Tencent map longitude and latitude conversion to Baidu map longitude and latitude implementation ideas and examples sharingPHP Tencent map longitude and latitude conversion to Baidu map longitude and latitude implementation ideas and examples sharing

21Aug2017

The PHP Tencent Map Longitude and Latitude Conversion to Baidu Map Longitude and Latitude class can convert the Baidu Map Longitude and Latitude into the corresponding longitude and latitude of Tencent Map/Google.

How to convert Baidu longitude and latitude to Tencent longitude and latitude using PHPHow to convert Baidu longitude and latitude to Tencent longitude and latitude using PHP

19Apr2023

During the development process, we usually need to process some geographical location information, and the longitude and latitude formats of different platforms are different, which requires conversion. This article will introduce how to convert Baidu longitude and latitude into Tencent longitude and latitude, and use PHP code to implement it. 1. The difference between Baidu’s longitude and latitude and Tencent’s longitude and latitude. Longitude and latitude are symbols of the position on the earth’s surface. They are expressed in different ways in different positioning systems. There are currently three mainstream positioning systems: WGS84, GCJ02 and BD09. Among them, WGS84 is the coordinate system used by the GPS positioning system, G

How to query longitude and latitude positioning on Baidu Map Introduction to the query method of longitude and latitude coordinate positioning on Baidu MapHow to query longitude and latitude positioning on Baidu Map Introduction to the query method of longitude and latitude coordinate positioning on Baidu Map

11Jul2024

As a map navigation application favored by users, Baidu Maps provides great convenience to users' lives. Today, the editor brings you the method of querying and positioning the longitude and latitude of Baidu map. Users in need should quickly learn it! I hope to be helpful! How to query the longitude and latitude positioning on Baidu map 1. First open Baidu from the computer and enter the homepage and click [Map] on the upper left; 2. Then enter the map page and find the [Map Open Platform] at the bottom and click; 3. Then come to the map After opening the platform page, slide the screen upward to find the tool that supports the click [Coordinate Picker] function; 4. Finally, move the mouse to see the latitude and longitude coordinates of any place on the map;

How to check the longitude and latitude of an area on Baidu Map How to check the longitude and latitude of an area on Baidu MapHow to check the longitude and latitude of an area on Baidu Map How to check the longitude and latitude of an area on Baidu Map

01Jul2024

How to check the longitude and latitude of a region on Baidu Map? Baidu Maps allows you to query the latitude and longitude coordinates of where you are or where you want to go. Many friends still don’t know how to check the longitude and latitude of a Baidu map area. Here we have compiled a method for querying the longitude and latitude of a Baidu map area. Let’s take a look. How to check the longitude and latitude of a Baidu map area 1. First step, click on the map open platform to open the Baidu map web version, and then we click on the small blue text below, the map open platform function. 2 The second step is to click on the coordinate picker. After we enter the map open platform, we then slide down and find the coordinate picker tool. 3 The third step is to view the coordinates. After we click the coordinate picker, we can then place it at any location to view the latitude and longitude.

See all articles