判断GPS经纬度坐标点是否在一个多边形范围内,测试代码如下:
$point = array('lng'=>'116.293616', 'lat'=>'39.884003');
$point = array('lng'=>'116.260846', 'lat'=>'39.879574');
$point = array('lng'=>'116.256247', 'lat'=>'39.790925');
$point = array('lng'=>'116.16771', 'lat'=>'39.771406');
$point = array('lng'=>'116.411474', 'lat'=>'39.74922');
//$point = array('lng'=>'116.652938', 'lat'=>'39.735016');
$areaJson = '[{"lng":116.231525,"lat":40.003488},{"lng":116.504035,"lat":39.995529},{"lng":116.627067,"lat":39.865397},{"lng":116.642015,"lat":39.745669},{"lng":116.315463,"lat":39.730577},{"lng":116.057901,"lat":39.837922},{"lng":116.351108,"lat":39.859194},{"lng":116.293616,"lat":39.884003}]';
var_dump(isPointInPolygon($point, json_decode($areaJson, true)));
1