PHP は GPS 座標に基づいて近くを検索します
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
リリース: 2016-07-25 08:43:24
-
-
- define('EARTH_RADIUS', 6370.6935);
-
- function neighbors($lng, $lat, $ distance = 0.5) {
- //$ distance = 0.5; // 单位 10KM
- $radius = EARTH_RADIUS;
-
- $dlng = rad2deg(2*asin(sin($ distance/(2*$radius))/cos($lat)));
- $dlat = rad2deg($ distance *10/$radius);
-
- $lng_left =round($lng - $dlng, 6);
- $lng_right =round($lng + $dlng, 6);
- $lat_top =round($lat + $dlat, 6);
- $lat_bottom =round($lat - $dlat, 6);
-
- return array('lng'=> array('left'=> $lng_left, 'right'=> $lng_right), 'lat'=> array('top'=> $lat_top, 'bottom'=> $lat_bottom));
- }
-
-
复制代码
|
PHP、GPS
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
著者別の最新記事
-
2025-02-26 03:58:14
-
2025-02-26 03:38:10
-
2025-02-26 03:17:10
-
2025-02-26 02:49:09
-
2025-02-26 01:08:13
-
2025-02-26 00:46:10
-
2025-02-25 23:42:08
-
2025-02-25 22:50:13
-
2025-02-25 21:54:11
-
2025-02-25 20:45:11
最新の問題
-
2025-03-21 13:39:34
-
2025-03-21 13:38:34
-
2025-03-21 13:37:19
-
2025-03-21 13:35:24
-
2025-03-21 13:34:32