我正在尝试在一些非常大的多边形图层上进行一些处理。但是我遇到了各种几何错误,例如:
NOTICE: Ring Self-intersection at or near point 470396.52017068537 141300.52235257279
CONTEXT: PL/pgSQL function st_intersection(geometry,raster,integer) line 10 at RETURN QUERY
SQL function "st_intersection" statement 1
NOTICE: Ring Self-intersection at or near point 504154.61769969884 140782.04115761846
CONTEXT: PL/pgSQL function st_intersection(geometry,raster,integer) line 10 at RETURN QUERY
SQL function "st_intersection" statement 1
NOTICE: Ring Self-intersection at or near point 505255.50242871145 140803.34860398644
CONTEXT: PL/pgSQL function st_intersection(geometry,raster,integer) line 10 at RETURN QUERY
SQL function "st_intersection" statement 1
NOTICE: Ring Self-intersection at or near point 510312.46970004693 141215.29256710084
CONTEXT: PL/pgSQL function st_intersection(geometry,raster,integer) line 10 at RETURN QUERY
SQL function "st_intersection" statement 1
NOTICE: Ring Self-intersection at or near point 510312.46970004693 141215.29256710084
CONTEXT: PL/pgSQL function st_intersection(geometry,raster,integer) line 10 at RETURN QUERY
SQL function "st_intersection" statement 1
NOTICE: Ring Self-intersection at or near point 511839.50335641927 141115.85781738357
CONTEXT: PL/pgSQL function st_intersection(geometry,raster,integer) line 10 at RETURN QUERY
SQL function "st_intersection" statement 1
NOTICE: Ring Self-intersection at or near point 515064.03024010791 140895.68087158105
CONTEXT: PL/pgSQL function st_intersection(geometry,raster,integer) line 10 at RETURN QUERY
SQL function "st_intersection" statement 1
NOTICE: Ring Self-intersection at or near point 519233.18724611058 140881.47590733573
CONTEXT: PL/pgSQL function st_intersection(geometry,raster,integer) line 10 at RETURN QUERY
SQL function "st_intersection" statement 1
NOTICE: Ring Self-intersection at or near point 521072.73011588014 141044.83299615697
CONTEXT: PL/pgSQL function st_intersection(geometry,raster,integer) line 10 at RETURN QUERY
SQL function "st_intersection" statement 1
NOTICE: Ring Self-intersection at or near point 523331.31943088671 141144.26774587421
CONTEXT: PL/pgSQL function st_intersection(geometry,raster,integer) line 10 at RETURN QUERY
SQL function "st_intersection" statement 1
NOTICE: Ring Self-intersection at or near point 523331.31943088671 141144.26774587424
CONTEXT: PL/pgSQL function st_intersection(geometry,raster,integer) line 10 at RETURN QUERY
SQL function "st_intersection" statement 1
NOTICE: Ring Self-intersection at or near point 523395.24176999065 140725.22130063715
CONTEXT: PL/pgSQL function st_intersection(geometry,raster,integer) line 10 at RETURN QUERY
SQL function "st_intersection" statement 1
NOTICE: Ring Self-intersection at or near point 524531.63890961662 140810.45108610913
CONTEXT: PL/pgSQL function st_intersection(geometry,raster,integer) line 10 at RETURN QUERY
SQL function "st_intersection" statement 1
我已经尝试过此处建议的功能:https : //trac.osgeo.org/postgis/wiki/UsersWikiCleanPolygons
对于清洁几何体,我使用的代码是:
UPDATE public.mytable
SET geom=cleangeometry(geom);
结果:
ERROR: GEOSisSimple: IllegalArgumentException: This method does not support GeometryCollection arguments
并且
UPDATE public.valid_mytable
SET geom=ST_MakeValid(geom);
这是可行的,但前提是我必须先将“几何”列更改为“几何”
ALTER TABLE public.mytable ALTER COLUMN geom SET DATA TYPE geometry;
这样就给我留下了一个不能再与其他功能一起使用的表!
ERROR: Relate Operation called with a LWGEOMCOLLECTION type. This is unsupported.
我尝试将列更改回几何(MultiPolygon)
ALTER TABLE public.my_table ALTER COLUMN geom SET DATA TYPE geometry(MultiPolygon);
但这失败了
ERROR: Geometry type (GeometryCollection) does not match column type (MultiPolygon)
我曾尝试过PostGIS in Action(第二版)http://www.manning.com/obe/,但是我只能找到用于查找无效几何的函数,但是我的数据集太大,无法手动修复,我真的需要可以自动修复的内容。
当我尝试运行ST_MakeValid()时,我已经能够隔离出问题多边形:
ERROR: Geometry type (GeometryCollection) does not match column type (MultiPolygon)
********** Error **********
ERROR: Geometry type (GeometryCollection) does not match column type (MultiPolygon)
SQL state: 22023
我在几何列上进行了类型检查,结果显示类型为“ MULTIPOLYGON”