首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >尝试使用st_distance_sphere筛选MySQL中的行时出错

尝试使用st_distance_sphere筛选MySQL中的行时出错
EN

Stack Overflow用户
提问于 2022-06-05 17:13:56
回答 1查看 250关注 0票数 1

我有一张带有polygon几何的桌子。我正在尝试基于点的邻近性来过滤行。

我使用st_distance_sphere计算距离并过滤行:链接

关于mysql表的快照、它的内容和我想要做的事情,请查看以下链接:8.0&fiddle=9e8bfca54f665f411453791c300c7fbd

当我运行查询时,

代码语言:javascript
复制
select *
from geo
where st_distance_sphere(Point(35.0872464,-106.6975887), ST_Centroid(`spatialdata`)) <= 1609*10;

我收到一个错误:

Error Code: 3617. Latitude -106.646665 is out of range in function st_distance_sphere. It must be within [-90.000000, 90.000000].

我想我需要用Long, Lat轴来计算距离。如何在mysql中做到这一点?

让人有点困惑的是: MySQL已经将所有几何学标准化为lat-long轴序。来自文档:The EPSG has standardized on latitude-longitude order, so all geographic SRSs defined by default in MySQL are latitude-longitude.

Doc链接:https://dev.mysql.com/blog-archive/axis-order-in-spatial-reference-systems/

EN

回答 1

Stack Overflow用户

发布于 2022-06-05 17:26:49

反转查询中Point对象中两个常量的顺序。

代码语言:javascript
复制
Point(-106.6975887, 35.0872464)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72509502

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档