Home >Backend Development >PHP Tutorial >php取范围内的坐标值

php取范围内的坐标值

WBOY
WBOYOriginal
2016-06-06 20:35:06985browse

需求这样,目前有 2000多个点的坐标,数组
$arr = [ [ 'lat' => 29.080832 'lng' => 119.068514 'stid' => 20914 ], ....... ];
$arr的坐标是有序排序的,按坐标从小到大排序,
并且
$arr共有2000多个子数组

<code>现在给定一个范围 ```
$range = [
    'minLng' => 119.0832423,
    'maxLng' => 119.0934235,
    'minLat' => 29.090978,
    'maxLat' => 29.329833 
]```


用二分法计算出所有落在$range范围内的坐标,代码?
</code>

回复内容:

需求这样,目前有 2000多个点的坐标,数组
$arr = [ [ 'lat' => 29.080832 'lng' => 119.068514 'stid' => 20914 ], ....... ];
$arr的坐标是有序排序的,按坐标从小到大排序,
并且
$arr共有2000多个子数组

<code>现在给定一个范围 ```
$range = [
    'minLng' => 119.0832423,
    'maxLng' => 119.0934235,
    'minLat' => 29.090978,
    'maxLat' => 29.329833 
]```


用二分法计算出所有落在$range范围内的坐标,代码?
</code>
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