我正在设置一个值isInside,好像用户geoLocation在表格内的任何形状之一内,我正在进行此查询
function getNearMe( $lat = 0 , $lng = 0 , $withDistance = 120)
{
try{
$q = $this->api->pdo->prepare("SELECT * ,
( 3959 * acos( cos( radians($lat) ) * cos( radians( store_latitude ) ) * cos( radians( store_longitude ) - radians($lng) ) +
sin( radians($lat) ) *
sin( radians( store_latitude ) ) ) ) AS distance,
ST_Intersects(Point($lng,$lat),`gps`) AS isInside
FROM stores
" . ( $withDistance == 0 ? "" : " HAVING distance < $withDistance " ) ."
ORDER BY distance
");
$q->execute();
return $q->fetchAll( PDO::FETCH_ASSOC );
}catch( PDOException $e ){
print_r($e);
return array();
}
}
ST_Intersects(Point($ lng,$ lat),
gps
)AS isInside
这是表格
但我收到此错误:
FUNCTION stores.ST_Intersects不存在
答案 0 :(得分:0)
我发现解决方案可能会帮助其他人
window._store.dispatch({type: "...", ...});