问题描述
在了解了关于在mySql中保存Polygon对象的这个后,
我仍然困惑于为什么以下插入操作失败,出现相同的
错误代码:3037.无效的GIS数据提供给函数st_geometryfromtext
。
INSERT INTO myGeom(id,ogc_geom)
VALUES
(
1,
GEOMFROMTEXT(
'POLYGON((
-85.4783714315732 9.8651106795296,
-85.4784492156346 9.8654277853092,
-85.4783714315732 9.8651106795296))'
)
);
它自己关闭,这里缺少什么(又增加了一点)?
一个稍微修改过的版本,可以运行...
- - 作品!
INSERT INTO mygeom(id,ogc_geom)
VALUES
(
552,
GEOMFROMTEXT(
'POLYGON((
-85.4783714315732 9.8651106795296,
-85.4784492156346 9.8654277853092,
-85.85451248764512 10.1234567893214,
-85.4783714315732 9.8651106795296))'
)
);
第一组值包含两个点和表单线段,而不是多边形(平面图)。
(有时可能会被认为是双面多边形,面积为零的退化多边形,但它是数学形式主义,而不是常见做法)。 b $ b
After learning about this constraint about saving Polygon objects in mySql, I am still puzzled as to why the following insert fails with the same Error Code: 3037. Invalid GIS data provided to function st_geometryfromtext
.
INSERT INTO myGeom (id, ogc_geom)
VALUES
(
1,
GEOMFROMTEXT(
'POLYGON((
-85.4783714315732 9.8651106795296,
-85.4784492156346 9.8654277853092,
-85.4783714315732 9.8651106795296))'
)
);
It closes itself, what bit is missing here (added one more point)?
A slightly modified version, that works...
-- WORKS !
INSERT INTO mygeom (id, ogc_geom)
VALUES
(
552,
GEOMFROMTEXT(
'POLYGON((
-85.4783714315732 9.8651106795296,
-85.4784492156346 9.8654277853092,
-85.85451248764512 10.1234567893214,
-85.4783714315732 9.8651106795296))'
)
);
The first set of values contains only two points and forms line segment, not a polygon (plane figure).
(Sometimes formally it might be considered as 2-sided polygon, degenerate polygon with zero area, but it is mathematical formalism, not a common practice)
这篇关于这个Polygon对象自己关闭。为什么插入仍然失败,错误3037:无效的GIS数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!