MySQL 根据经纬度计算两坐标之间的距离

    xiaoxiao2023-10-07  141

    根据经纬度计算两坐标之间的距离:

    SELECT latitude, longitude, ROUND( 6378.138 * 2 * ASIN( SQRT( POW( SIN( ( latitude * PI() / 180 - latitude * PI() / 180 ) / 2 ), 2 ) + COS(latitude * PI() / 180) * COS(latitude * PI() / 180) * POW( SIN( ( longitude * PI() / 180 - longitude * PI() / 180 ) / 2 ), 2 ) ) ) * 1000 ) AS distance FROM gs_store WHERE store_type = 2
    最新回复(0)