简体   繁体   English

多边形中的点:提供给函数 st_within 的 GIS 数据无效

[英]Point in Polygon: Invalid GIS data provided to function st_within

I'm trying to determine if a given point is within a polygon through MySQL.我正在尝试通过 MySQL 确定给定点是否在多边形内。 I have setup a table called 'municipalities' with the following columns:我已经设置了一个名为“市政”的表,其中包含以下列:

|  column  |  type   |
|----------|---------|
|    id    |   int   |
|   name   | varchar |
| location | polygon |

I have imported a bunch of rows and now I'm trying to find a row where a given point is within the polygon.我已经导入了一堆行,现在我试图找到一个给定点在多边形内的行。 I'm using this query:我正在使用这个查询:

SELECT * FROM municipalities 
WHERE st_contains(
    location, 
    ST_GEOMFROMTEXT('POINT(50.849243 5.690800)')
);

Unfortunately, this results in an error: "Invalid GIS data provided to function st_within."不幸的是,这会导致错误: “提供给函数 st_within 的 GIS 数据无效。” . .

I'm completely lost as to why I'm getting this error.我完全不知道为什么我会收到这个错误。 I'm starting to think that the location column might contain faulty data, but I'm not sure how to check for that.我开始认为位置列可能包含错误数据,但我不确定如何检查。

Can anyone provide some insight into why this query is failing?任何人都可以提供一些有关此查询失败原因的见解吗?

Note: I'm using MySQL 5.7.22注意:我使用的是 MySQL 5.7.22

You may need to specify the EPSG of your point.您可能需要指定点的 EPSG。

ST_GeomFromText('POINT(45 90)', 4326);

Make sure that's in the same EPSG of your location data EPSG.确保它与您的位置数据 EPSG 位于同一 EPSG。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MySQL 错误 3037:提供给 function st_within 的无效 GIS 数据 - MySQL ERROR 3037: Invalid GIS data provided to function st_within MYSQL 提供给 function st_geomfromtext 的无效 GIS 数据用于 POINT 而不是多边形 - MYSQL Invalid GIS data provided to function st_geomfromtext for a POINT not a Polygon 为MBR中的st_geometryfromtext函数提供的无效GIS数据包含LineFromText - Invalid GIS data provided to function st_geometryfromtext in MBRContains LineFromText MySQL - 提供给函数 st_polygonfromtext 的 GIS 数据无效 - MySQL - Invalid GIS data provided to function st_polygonfromtext MySQL:提供给函数 st_geometryfromtext 的无效 GIS 数据 - MySQL: Invalid GIS data provided to function st_geometryfromtext MySQL 5.7.19 提供给函数 st_geometryfromtext 的 GIS 数据无效 - MySQL 5.7.19 Invalid GIS data provided to function st_geometryfromtext 提供无效的GIS数据给MySQL中的st_geometryfromtext函数 - Invalid GIS data provided to function st_geometryfromtext in MySQL 提供给功能st_geometryfromwkb的GIS数据无效 - Invalid GIS data provided to function st_geometryfromwkb 带有 POLYGON 的 mysql ST_WITHIN - mysql ST_WITHIN with POLYGON ASP.NET 中的几何 MySQL 查询向函数 st_geometryfromtext 提供的 GIS 数据无效 - Geometry MySQL Query in ASP.NET | Invalid GIS data provided to function st_geometryfromtext
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM