Home >php教程 >php手册 >gps 搜索附近坐标

gps 搜索附近坐标

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 19:35:07916browse

无详细内容 无 ?phpdefine('EARTH_RADIUS', 6370.6935);function vicinity($lng, $lat, $distance = 5) {//$distance = 5;// 单位 1KM$radius = EARTH_RADIUS;$dlng = abs(rad2deg(2*asin(sin($distance/(2*$radius))/cos($lat))));$dlat = abs(rad2deg($dist

<?php

define('EARTH_RADIUS', 6370.6935);

function vicinity($lng, $lat, $distance = 5) {
	//$distance = 5;		// 单位 1KM
	$radius = EARTH_RADIUS;
	
	$dlng = abs(rad2deg(2*asin(sin($distance/(2*$radius))/cos($lat))));
	$dlat = abs(rad2deg($distance/$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));
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:XSS杀手Next article:生成二维码