原 ERROR: lwgeom_difference: GEOS Error: TopologyException: Input geom 0 is invalid: Too few points in
版权声明:本文为博主原创文章,请尊重他人的劳动成果,转载请附上原文出处链接和本声明。
本文链接:https://www.91mszl.com/zhangwuji/article/details/1332
一:postgresql 使用 ST_Difference 报错信息如下:
ERROR: lwgeom_difference: GEOS Error: TopologyException: Input geom 0 is invalid: Too few points in geometry component at or near point 120.125613752384 31.665662179977399 at 120.125613752384
二:我的sql 如下:
select ST_Difference(
(
select geom from table where id=1 -- sqlA
),
(
select geom from table where id=2 -- sqlB
)
) as boundar
单独运行 sqlA和sqlB都是正确的,执行整段sql后报错。
三:解决办法,加上ST_buffer,完整的sql如下:
select ST_Difference(
(
select ST_buffer(geom, -0.00) from table where id=1 -- sqlA
),
(
select ST_buffer(geom, -0.00) from table where id=2 -- sqlB
)
) as boundar
2021-06-24 17:15:11 阅读(1786)
名师出品,必属精品 https://www.91mszl.com
博主信息