MySQL 5.7: Invalid GIS data

独自空忆成欢 提交于 2019-12-23 12:43:52

问题


The following query seems to be working just fine under MySQL 5.6 (returns 0 for the Area), but on MySQL 5.7 it returns an error saying ERROR 3037 (22023): Invalid GIS data provided to function st_area..

SELECT ST_Area(GeomFromText('POLYGON((0 0, 0 0, 0 0, 0 0, 0 0))'))

Is it possible to either ignore the error and return zero, or create a query to filter any such geometries from the query before running it?

A very simple schema and query example would be:

CREATE TABLE `polygons` (`id` int, `geom` GEOMETRY);

INSERT INTO `polygons` VALUES (1, GeomFromText('POLYGON((0 0, 0 0, 0 0, 0 0, 0 0))'));

SELECT `id`, ST_Area(`geom`) FROM `polygons`;

来源:https://stackoverflow.com/questions/34511741/mysql-5-7-invalid-gis-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!