- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我想获取我所在位置周围的所有位置,但函数 ST_Distance_Sphere
不起作用。
我的查询:
select *, astext(location) as location from `locations`
where ST_Distance_Sphere(location, POINT(35.905069591297, 49.765869174153)) < 1000
错误:
SQLSTATE[42000]: Syntax error or access violation:
1305 FUNCTION app.ST_Distance_Sphere does not exist (SQL:
select *, astext(location) as location from `locations`
where ST_Distance_Sphere(location, POINT(35.905069591297, 49.765869174153)) < 1000)
最佳答案
如果还需要MariaDB中的函数,可以根据公式创建函数
CREATE FUNCTION `st_distance_sphere`(`pt1` POINT, `pt2` POINT) RETURNS
decimal(10,2)
BEGIN
return 6371000 * 2 * ASIN(SQRT(
POWER(SIN((ST_Y(pt2) - ST_Y(pt1)) * pi()/180 / 2),
2) + COS(ST_Y(pt1) * pi()/180 ) * COS(ST_Y(pt2) *
pi()/180) * POWER(SIN((ST_X(pt2) - ST_X(pt1)) *
pi()/180 / 2), 2) ));
END
关于database - MariaDB 中不存在 FUNCTION ST_Distance_Sphere,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44409012/
在尝试创建一个应用程序,其功能之一是搜索给定点附近的某些地方时,我遇到了以下错误: SequelizeDatabaseError: st_distance_sphere (geometry, geom
我正在尝试查询一个小表以查找表中输入坐标点 1 公里以内的所有记录。表中的每条记录都有一个带有相应点的“Lat”和“Long”列。我的查询是 var sql = `SELECT * FROM GeoT
我正在做一个 Python 项目,我有两个纬度/经度对,我想计算它们之间的距离。在其他项目中,我使用 ST_Distance_Sphere(a.loc_point, b.loc_point) 在 Po
这是我的代码: SELECT st_distance_sphere( POINT(8,51) , point(@lon, @lat)) as distance FROM places; 如果我执行它
在 MySQL 5.7 中,有一个名为 ST_Distance_Sphere 的函数,可用于查找半径内的点,例如: CREATE TABLE `places` ( `id` int(11) uns
使用 st_distance_sphere 时从 MySQL 给出的结果看起来真的很不稳定。 在用户表上运行此查询:(距离点9.45公里以内的用户列表) select *, st_distance_s
我的要求 是计算给定map 上两个位置 之间的距离使用 mysql .我在 mysql 中找到了一个函数命名为ST_Distance_Sphere它返回球体上两个位置和/或多个位置之间的最小球面距离(
我想获取我所在位置周围的所有位置,但函数 ST_Distance_Sphere 不起作用。 我的查询: select *, astext(location) as location from `loc
我有包含列 ID、名称、位置的表格区域。列位置是 POINT 类型,存储地点的(纬度、经度)。 我读到了一个在 MySQL 中使用点数据类型和 st_distance_sphere 查找最近地点的解决
我正在使用 PostgreSQL v9.1.11 和 PostGIS 2.1.0。我正在使用 st_distance_sphere 来计算各个点之间的距离,但得到的结果不正常。根据文档,该函数应返回提
我有一个 MySQL 查询: UPDATE `location` `l1` SET `l1`.`city_id` = ( SELECT `c1`
我是 Postgis 和空间方面的新手,我正在为非常简单的查询而苦苦挣扎。 我在 places 中有两条记录用于测试,其中列 addressLocation 是具有以下值的 POINT: (51.12
我有一个名为 place 的表: id | name | coordinates (longitude, latitude) 1 | London | -0.12574, 51.
我发现了这个Stack Overflow问题。 Distance in meters between two Spacial Points in MySQL query 我想为我的用例实现它,但出现此
我是一名优秀的程序员,十分优秀!