我对 sfcgal 扩展方法(例如 st_3darea、st_3dintersection、使用多重多边形)有疑问。
当多边形接触时,我收到一条错误消息,指出多边形相交。 这两个三角形显然不相交,只是接触:
SELECT st_3darea(ST_GeomFromText(
'MULTIPOLYGON Z (((1 0 0, 1 1 0, 0 1 1, 1 0 0)),
((1 0 0, 0 1 1, 0 0 1, 1 0 0)))'));
但我收到一个错误:
ERROR: MultiPolygon is invalid : intersection between Polygon 0 and 1 : MULTIPOLYGON(((1/1 0/1 0/1,1/1 1/1 0/1,0/1 1/1 1/1,1/1 0/1 0/1)),((1/1 0/1 0/1,0/1 1/1 1/1,0/1 0/1 1/1,1/1 0/1 0/1)))
SQL state: XX000
请帮忙。
欢迎提出任何建议
最佳答案
您的MULTIPOLYGON
无效,因为多边形相交。使用 ST_MakeValid
解决此问题:
SELECT
ST_3DArea(
ST_MakeValid('MULTIPOLYGON Z (((1 0 0, 1 1 0, 0 1 1, 1 0 0)),
((1 0 0, 0 1 1, 0 0 1, 1 0 0)))'::geometry));
st_3darea
------------------
1.41421356237309
(1 row)
正如@JGH 所指出的(参见评论):
ST_Overlaps, ST_Touches, ST_Within all imply spatial intersection. If any of the aforementioned returns true, then the geometries also spatially intersect. Disjoint implies false for spatial intersection.
关于postgresql - POSTGRES POSTGIS sfcgal - st_3darea 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68379566/