MySQL:二元几何函数 st_contains 给定两个不同 srids 的几何:4326 和 0

MySQL: Binary geometry function st_contains given two geometries of different srids: 4326 and 0

我试图通过使用 MySQL 中的 Point 数据类型 select 城市 and/or 地区,使用 Laravel.

查询如下:

SELECT id, bounding_box 
FROM `districts` 
WHERE ST_Contains(ST_GeomFromText('Point(-96.505144 41.322207)', 4326), bounding_box)

districts table

这给了我一个例外:Binary geometry function st_contains given two geometries of different srids: 4326 and 0, which should have been identical.

当我从查询中的 ST_GeomFromText 中删除 SRID 时,异常在异常中给我一个相反的 SRID 顺序:

Binary geometry function st_contains given two geometries of different srids: 0 and 4326, which should have been identical.

我使用 ST_GeomFromGeoJSON 来解析我的多边形。 ST_GeomFromGeoJSON() 的 MySQL 文档告诉我使用的默认 SRID 是 4326。

在我的 bounding_box 上使用 ST_Transform() 给我例外:Transformation from SRID 0 is not supported.,但我不明白为什么它是 SRID 0,而导入的默认值是 4326。

我如何正确使用 ST_Contains 来查询我的 table 基于 Point 数据类型的选区?使用 ST_Within.

时我得到相同的行为

没关系,我想通了。

我将 "crs":{"type":"name","properties":{"name":"EPSG:4326"}} 添加到 GeoJSON 多边形中,我用它来补水数据库。