postgis修复几何,修复自相交

Posted JerFer

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了postgis修复几何,修复自相交相关的知识,希望对你有一定的参考价值。

1、报错问题

一般进行空间查询分析的时候,数据库报错如下:

NOTICE:  Ring Self-intersection at or near point 98.56186929203426 25.024940000380752
NOTICE:  Ring Self-intersection at or near point 98.840470640108038 24.256657960096845
NOTICE:  Ring Self-intersection at or near point 101.0043257882046 24.190313156127331

表示有图形自相交了。
图形如图所示:

2、处理方式如下

-- 把自相交的数据放在一个临时表里面
CREATE TABLE temp1 as select * from zd where ST_IsValid(shape) = false;
-- 原表中删除自相交的数据
delete from  zd where ST_IsValid(shape) = false;
select st_geometryType(st_multi(ST_Buffer(shape, 0.0))),st_geometryType(shape) from temp1;
-- 处理自相交数据
update temp1 set shape =st_multi(ST_Buffer(shape, 0.0))
-- 写入
insert into zd select * from temp1

以上是关于postgis修复几何,修复自相交的主要内容,如果未能解决你的问题,请参考以下文章

postgis修复几何,修复自相交

postgis修复几何,修复自相交

求助,ARCGIS中区自相交如何解决?

PostGIS 常用函数中文介绍说明

如何修复具有大共享坐标的模型上的抖动几何

Postgis安装:类型“几何”不存在