错误消息如下:
“错误:几何包含非闭环”
我的代码如下所示:
CREATE TABLE GhanaRegions (
Id serial,
Geometry geometry DEFAULT NULL,
PRIMARY KEY (Id)
);
INSERT INTO GhanaRegions(Geometry) VALUES (ST_GeomFromText('POLYGON ((-0.024861 10.856,
-0.0250165 10.8561,
-0.0252813 10.8562,
-0.0254853 10.8563,
-0.0256633 10.8565,
-0.0259642 10.8566,
-0.0262956 10.8568,
-0.0265517 10.8572,
-0.0267774 10.8576,
-0.0270798 10.8579,
-0.0273258 10.8581,
0.02766 10.8584))'));
答案 0 :(得分:5)
第一点和最后一点必须是同一点。如果它们不同,则环不会关闭,并且无法构建多边形。
解决方案:第一点必须使用两次,第一点和最后一点:
INSERT INTO GhanaRegions(Geometry) VALUES (ST_GeomFromText('POLYGON ((
-0.024861 10.856,
-0.0250165 10.8561,
-0.0252813 10.8562,
-0.0254853 10.8563,
-0.0256633 10.8565,
-0.0259642 10.8566,
-0.0262956 10.8568,
-0.0265517 10.8572,
-0.0267774 10.8576,
-0.0270798 10.8579,
-0.0273258 10.8581,
0.02766 10.8584,
-0.024861 10.856
))'));