Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 使用lat&;长的_Mysql - Fatal编程技术网

Mysql 使用lat&;长的

Mysql 使用lat&;长的,mysql,Mysql,我使用php找到了lat&long 发件人地址: 纬度:42.466004 长:-76.469566 解决: 纬度:42.424604 长:-76.514676 使用php获取客户想要搜索地址的长度和长度 list($find_lat,$find_long) = $this->findLatLongFromAddress($res_address); 我正在使用这个查询 SELECT restaurant_id, restaurant_name, ROUND( ( 3959 * acos

我使用php找到了lat&long

发件人地址:

纬度:42.466004 长:-76.469566

解决:

纬度:42.424604 长:-76.514676

使用php获取客户想要搜索地址的长度和长度

list($find_lat,$find_long) = $this->findLatLongFromAddress($res_address);
我正在使用这个查询

SELECT restaurant_id, restaurant_name, ROUND( ( 3959 * acos( cos( radians( 42.466004 ) ) * cos( radians( restaurant_lat ) ) * cos( radians( restaurant_long ) - radians( - 76.469566 ) ) + sin( radians( 42.466004 ) ) * sin( radians( restaurant_lat ) ) ) ) , 2 ) AS distance, restaurant_delivery_distance
FROM rt_restaurant
WHERE restaurant_lat != ''
AND restaurant_long != ''
我得到的距离是3.67英里。这是错误的查询

但我用这两个地址在谷歌地图和互联网上搜索。距离是7.2英里

请帮帮我。
提前感谢

这仅仅是因为谷歌地图会显示您的旅行距离(例如在车内)。MySQL查询计算将显示距离


您的查询正在运行,但无法比较结果。此外,除非您保存一个包含道路的数据库,并使用类似Google Map的算法,否则您将无法自己计算出行距离。

这两种方法的结果无法进行比较。!