gpt4 book ai didi

mysql FUNCTION 存储。ST_Intersects 不存在

转载 作者:行者123 更新时间:2023-11-29 17:54:42 27 4
gpt4 key购买 nike

我正在尝试设置一个值 isInside ,就好像用户地理位置位于表内的任何形状之一内,我正在执行此查询

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

这是表格

enter image description here

但我收到此错误:

FUNCTION stores.ST_Intersects does not exist

最佳答案

我发现该解决方案可能对其他人有帮助

MBRContains(gps,
GeomFromText('Point($lat $lng)')) AS isInside

关于mysql FUNCTION 存储。ST_Intersects 不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48962378/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com