依据经纬度计算距离的公式、百度坐标转换成GPS坐标(PHP版)
根据经纬度计算距离的公式、百度坐标转换成GPS坐标(PHP版)
<?php //百度坐标转换成GPS坐标 $lnglat = '121.437518,31.224665'; function FromBaiduToGpsXY($lnglat){ // 经度,纬度 $lnglat = explode(',',$lnglat); list($x,$y) = $lnglat; $Baidu_Server = "http://api.map.baidu.com/ag/coord/convert?from=0&to=4&x={$x}&y={$y}"; $result = @file_get_contents($Baidu_Server); $json = json_decode($result); if($json->error == 0) { $bx = base64_decode($json->x); $by = base64_decode($json->y); $GPS_x = 2 * $x - $bx; $GPS_y = 2 * $y - $by; return $GPS_x.','.$GPS_y;//经度,纬度 } else return $lnglat; } /**********************************************/ function fn_rad($d) { return $d * pi() / 180.0; } // 2点间算法 function P2PDistance($latlng1,$latlng2) { // 纬度1,经度1 ~ 纬度2,经度2 $latlng1 = explode(',',$latlng1); $latlng2 = explode(',',$latlng2); list($lat1,$lng1) = $latlng1; list($lat2,$lng2) = $latlng2; $EARTH_RADIUS = 6378.137; $radLat1 = fn_rad($lat1); $radLat2 = fn_rad($lat2); $a = $radLat1 - $radLat2; $b = fn_rad($lng1) - fn_rad($lng2); $s = 2 * asin(sqrt(pow(sin($a/2),2) + cos($radLat1)*cos($radLat2)*pow(sin($b/2),2))); $s = $s * $EARTH_RADIUS; $s = round($s * 10000) / 10000; return number_format($s,2); } echo '百度坐标: ',$lnglat,'<br><br>','转换后GPS坐标: ',FromBaiduToGpsXY($lnglat),'<br><br>'; echo '转换前距离: ',P2PDistance('31.224286666667,121.420675','31.224665,121.437518'),'<br/>'; echo '转换后距离: ',P2PDistance('31.224286666667,121.420675','31.220157068379,121.42647022694'); ?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The usage of return in C language is: 1. For functions whose return value type is void, you can use the return statement to end the execution of the function early; 2. For functions whose return value type is not void, the function of the return statement is to end the execution of the function. The result is returned to the caller; 3. End the execution of the function early. Inside the function, we can use the return statement to end the execution of the function early, even if the function does not return a value.

GarminGPS itself has the ability to change files, maps, routes and waypoints. However, it's often more efficient to connect the device to your computer and use BaseCamp software. In rare cases, you may find that your computer does not recognize GarminGPS. Don't worry because you're not alone, USB cable errors are usually easy to fix. In the worst case scenario, you will have to buy a new wire for your device. Follow along as we put together a comprehensive list of solutions you can try to fix the error as soon as we see what other products the company makes. Follow us! What products does Garmin make? In addition to GPS devices, the company also makes activity trackers and sports watches that track

GPS toolbox software is a powerful positioning software designed for daily travel and is committed to providing users with the safest and smartest positioning services. Once you download and register the software, it's easy to mark your location accurately. The software has a variety of practical functions, bringing great convenience to users. Whether for personal use or sharing with family, GPS Toolbox makes it easy to mark your location. So how to use the GPS toolbox to mark the location? This tutorial guide will give you a detailed introduction. Users who want to know more can come and continue reading along with this article. How to mark location with gps toolbox? 1. Open the GPS toolbox and find the marked location. 2. Find the calibration. 3. Find the mark note. 4. Click Save

Source code: publicclassReturnFinallyDemo{publicstaticvoidmain(String[]args){System.out.println(case1());}publicstaticintcase1(){intx;try{x=1;returnx;}finally{x=3;}}}#Output The output of the above code can simply conclude: return is executed before finally. Let's take a look at what happens at the bytecode level. The following intercepts part of the bytecode of the case1 method, and compares the source code to annotate the meaning of each instruction in
![Location Services/GPS not working on iPhone [Solved]](https://img.php.cn/upload/article/000/465/014/168441372636105.png?x-oss-process=image/resize,m_fill,h_207,w_330)
In order to run effectively, some apps require GPS or location services to work properly on iPhone. But many iPhone users reported that location services/GPS suddenly stopped working on their iPhones. There are many reasons why GPS may not work on your iPhone, some of which are listed below. Outdated Apple mobile software location services option is turned off Technical glitch inside iPhone iPhone is located in remote low signal area Incorrect date and time set on iPhone After studying the above points, we have gathered more information and included in the article below A few strong fixes have been compiled for this issue. Preliminary fix for restarting iPhone when iPhone displays certain

NASA has confirmed the existence of a global electric field around Earth, achieved through a recent rocket launch. This is a big deal, since this is the first direct measurement of a phenomenon which has been long theorized but has never been observe

Difference: 1. Different definitions. GPS refers to the Global Positioning System, which is a high-precision radio navigation positioning system based on aerial satellites; while GNSS refers to the Global Navigation Satellite System, which uses the pseudorange, ephemeris, and satellite information of a group of satellites. Observations such as launch time. 2. Different applications. GPS is mainly used for navigation and positioning. It has attracted many users with its high accuracy, all-weather, global coverage, convenience and flexibility; GNSS can provide users with all-weather 3D coordinates at any location on the earth's surface or near-earth space. and speed and time information space-based radio navigation and positioning systems.

There is a big difference between gnss and gps, because GNSS (global navigation satellite system) and GPS (global positioning system) are two related but not identical concepts. GNSS is a broad concept that covers various countries and regions around the world. There are multiple satellite navigation systems developed and operated by the United States, while GPS refers solely to the satellite navigation system developed and operated by the United States government.
