version: provider: 四维数码研发部 lastupdated: [ 2024-11-22, ] name: 拓扑检查 topoCheck: P00: note: "点图层有效性" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode, geometry POINT); insert into @outtable@ select null,createuuid(),ogc_fid sid,'P00' rulecode, geometry from @intable_s@ where geometrytype(geometry) = 'POINT' and isvalid(geometry) <> 1; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), (select replace(type_name , ' Z', '') from geometry_type_mapping where type_code = (select geometry_type from geometry_columns where f_table_name = '@intable_s@')), (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@')); " UI: inparam: - type: vector ARG: intable_s name: 输入点图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "P00.png" icon: "processingAlgorithm.png" description: "说明:点要素不能无效。" P01: note: "点必须不能相交(单点)" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POINT); with t as( select createuuid(),c.ogc_fid sid, d.ogc_fid did,'P01' rulecode, c.geometry geometry from idx_@intable_s@_geometry a, idx_@intable_s@_geometry b, @intable_s@ c, @intable_s@ d where a.rowid < b.rowid and (a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax) and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry) and geometrytype(c.geometry) = 'POINT' and geometrytype(d.geometry) = 'POINT') insert into @outtable@ select null,createuuid(),sid,did,rulecode,geometry from t; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), (select replace(type_name , ' Z', '') from geometry_type_mapping where type_code = (select geometry_type from geometry_columns where f_table_name = '@intable_s@')), (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入点图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "P01.png" icon: "processingAlgorithm.png" description: "说明:一个图层中的点要素不能与同一图层中的点要素重合。被另一个点覆盖的任何点都是错误的。" L00: note: "线图层有效性" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode, geometry MULTILINESTRING); insert into @outtable@ select null,createuuid(),ogc_fid sid,'L00' rulecode, geometry geometry from @intable_s@ where isvalid(geometry) <> 1; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), (select replace(type_name , ' Z', '') from geometry_type_mapping where type_code = (select geometry_type from geometry_columns where f_table_name = '@intable_s@')), (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "L00.png" icon: "processingAlgorithm.png" description: "说明:线要素不能无效" L01: note: "线不能有悬挂点" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POINT); with d as ( select createuuid(), ogc_fid, 'e' || ogc_fid flag, startpoint(geometry) geometry from @intable_s@ where not isring(geometry) union select createuuid(), ogc_fid, 'e' || ogc_fid flag, endpoint(geometry) from @intable_s@ where not isring(geometry) ), u as ( select d.ogc_fid sid,flag, g.ogc_fid did, intersection(d.geometry, g.geometry) geometry from d, idx_@intable_s@_geometry t, @intable_s@ as g where X(d.geometry) between t.xmin and t.xmax and Y(d.geometry) between t.ymin and t.ymax and t.rowid = g.rowid and intersects(d.geometry, g.geometry) = 1 and d.ogc_fid <> g.ogc_fid union select ogc_fid, 's' || ogc_fid flag, null did, startpoint(geometry) geometry from @intable_s@ where numpoints(geometry) > 2 and intersects(startpoint(geometry), removepoint(geometry, 0)) = 1 and not isring(geometry) union select ogc_fid, 'e' || ogc_fid flag, null did, endpoint(geometry) geometry from @intable_s@ where numpoints(geometry) > 2 and intersects( endpoint(geometry), removepoint(geometry, numpoints(geometry) -1) ) = 1 and not isring(geometry) ) insert into @outtable@ select null,createuuid(),ogc_fid sid, flag did, 'L01' rulecode, geometry from d where flag not in (select flag from u); select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'POINT', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "L01.png" icon: "processingAlgorithm.png" description: "说明:一个图层中的线必须在两个端点处与同一图层中的其他线接触。线的任何端点未与其他线接触都是错误的。" L02: note: "线不能有伪节点" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POINT); with t as ( select PIEUUID, sid, did, rulecode, geometry from ( select PIEUUID, id1 sid,id2 did,'L02' rulecode, inter geometry from ( select PIEUUID, id1, group_concat( casttotext( within(inter, gc) + within(inter, gd) ) , '_') id2 , inter from ( select createuuid() PIEUUID, c.ogc_fid id1, d.ogc_fid id2,c.geometry gc, d.geometry gd, intersection(c.geometry, d.geometry) inter from idx_@intable_s@_geometry a, idx_@intable_s@_geometry b, @intable_s@ c, @intable_s@ d where a.rowid < b.rowid and (a.xmin < b.xmax and a.xmax > b.xmin and a.ymin < b.ymax and a.ymax > b.ymin) and a.rowid = c.rowid and b.rowid = d.rowid and touches(c.geometry, d.geometry) ) t1 group by inter ) t2 where geometrytype( inter ) = 'POINT' and id2='0' union select createuuid(),ogc_fid sid, null did ,'L02' rulecode, startpoint(geometry) geometry from @intable_s@ where not isring(geometry) and st_npoints(geometry) > 2 and touches( startpoint(geometry), removepoint(geometry, 0) ) = 1 union select createuuid(), ogc_fid sid, null did ,'L02' rulecode, endpoint(geometry) geometry from @intable_s@ where not isring(geometry) and st_npoints(geometry) > 2 and touches( endpoint(geometry), removepoint(geometry, st_npoints(geometry)-1 ) ) = 1 order by id1)) insert into @outtable@ select null,createuuid(),sid,did,rulecode,geometry from t; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'POINT', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "L02.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的线必须在其端点处与同一图层中的多条线接触。线的任何端点仅与一条其他线接触都是错误的。" L03: note: "线必须为单一部分" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry MULTILINESTRING); insert into @outtable@ select null,createuuid(),ogc_fid sid,'L03' rulecode, casttomulti(geometry) geometry from @intable_s@ where geometry is not null and casttosingle(geometry) is null; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTILINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "L03.png" icon: "processingAlgorithm.png" description: "说明:一个图层中的线要素不能具有一个以上的构成部分。任何具有超过一个构成部分的线要素都是错误的。" L04: note: "线不能重叠(线)" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtableP: meaning: 输出点错误表的名字 type: B - outtableL: meaning: 输出线错误表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@outtable@=输出错误表的名字' ] RUNTYPE: repl ALG: "drop view if exists tempTableC; create view tempTableC as WITH cte(idx, sid, did,cnt,geometry,point) AS ( SELECT 1 idx, sid, did ,cnt, geometry, geometryN(geometry, 1) point from ( select c.ogc_fid sid, d.ogc_fid did,numGeometries(intersection(c.geometry, d.geometry)) cnt, intersection(c.geometry, d.geometry) geometry from idx_@intable_s@_geometry a,idx_@intable_s@_geometry b, @intable_s@ c, @intable_s@ d where a.rowid < b.rowid and (a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax) and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry) = 1 and overlaps(c.geometry, d.geometry) = 1 ) t UNION ALL SELECT idx + 1 idx, sid, did, cnt,geometry, geometryN(geometry , idx +1 ) point FROM cte WHERE idx < cnt ) SELECT sid, did, case geometrytype(casttomulti( point)) when 'MULTIPOINT' then '0' when 'MULTILINESTRING' then '1' end as rulecode, casttomulti( point) geometry FROM cte; drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTILINESTRING); insert into @outtable@ SELECT null,createuuid(),sid, did, 'L04' rulecode, geometry FROM tempTableC where rulecode = '1'; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTILINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "L04.png" icon: "processingAlgorithm.png" description: "说明:一个图层中的线不能与同一图层中的线重叠。任何重叠的线都是错误的。" L05: note: "线不能相交(线)" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POINT); with t as ( select createuuid(),c.ogc_fid sid, d.ogc_fid did, numGeometries(ExtractMultiPoint(intersection(c.geometry, d.geometry))) cnt, ExtractMultiPoint(intersection(c.geometry, d.geometry)) geometry from idx_@intable_s@_geometry a,idx_@intable_s@_geometry b, @intable_s@ c, @intable_s@ d where a.rowid < b.rowid and (a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax) and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry) = 1 and crosses(c.geometry, d.geometry) = 1 and ExtractMultiPoint(intersection(c.geometry, d.geometry)) is not null ), cte(PIEUUID,idx, sid, did, cnt,geometry,line) AS ( SELECT createuuid(),1 idx, sid, did,cnt, geometry, geometryN(geometry, 1) line from t UNION ALL SELECT createuuid(),idx + 1 idx, sid, did, cnt,geometry, geometryN(geometry , idx +1 ) line FROM cte WHERE idx < cnt ) insert into @outtable@ SELECT null,PIEUUID,sid, did,'L05' rulecode, line geometry FROM cte order by sid, did; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'POINT', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "L05.png" icon: "processingAlgorithm.png" description: "说明:同一图层中的线互相之间不能相交或叠置。任何与要素叠置的线或任何相交点都是错误的。" L06: note: "线不能自重叠" lastupdated: [ 2024-11-22, ] roadmap: "临时表创建为view无法建立索引,暂时去除索引判断" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - tolerance: meaning: 容差 type: f RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@tolerance@=容差','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists temp_line; create table temp_line(UUID,id integer, idx integer, cnt integer, geometry LINESTRING); insert into temp_line(UUID,id, idx,cnt, geometry) WITH t as (select createuuid(), ogc_fid id, numGeometries(DissolveSegments(geometry)) cnt, DissolveSegments(geometry) geometry from @intable_s@ where numpoints(geometry) > 2 ) ,cte(UUID,idx, id,cnt,geometry,line) AS ( SELECT createuuid(),1 idx, id ,cnt, geometry, geometryN(geometry, 1) line from t UNION ALL SELECT createuuid(),idx + 1 idx, id, cnt,geometry, geometryN(geometry , idx +1 ) line FROM cte WHERE idx < cnt ) SELECT UUID,id, idx, cnt,transform(line,3857) geometry FROM cte order by id, idx; select recovergeometrycolumn('temp_line', 'geometry', 3857, 'LINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@')); select CreateSpatialIndex('temp_line', 'geometry'); drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,idx,rulecode,geometry MULTILINESTRING); with t1 as( select createuuid() UUID,c.id sid, (c.idx || '_' || d.idx) idx, collect(c.geometry, d.geometry) geom, abs(degrees(azimuth(startpoint(c.geometry), endpoint(c.geometry)) - azimuth(startpoint(d.geometry), endpoint(d.geometry)))) angle, abs( ST_MaxDistance(c.geometry, d.geometry) - st_length(c.geometry) - st_length(d.geometry)) maxdist, ExtractMultiLinestring(intersection(c.geometry, d.geometry)) inter from idx_temp_line_geometry a, idx_temp_line_geometry b, temp_line c, temp_line d where (a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax) and a.rowid = c.rowid and b.rowid = d.rowid and c.id = d.id and c.idx < d.idx and (( abs(c.idx - d.idx) > 1 and abs(c.idx - d.idx) <> c.cnt - 1 and st_distance(c.geometry, d.geometry) < @tolerance@ ) or (inter is not null) ) order by c.id, c.idx, d.idx ), t2 as( select UUID, sid, idx, 'L06' rulecode, casttomulti(transform(geom,CastToInteger( (select srid from geometry_columns where f_table_name = '@intable_s@') ))) geometry from t1 where (angle < 2.0 or abs( angle - 180.0 ) < 2.0 ) and maxdist > @tolerance@) insert into @outtable@ select null,UUID,sid,idx,rulecode,geometry from t2; select recovergeometrycolumn('@outtable@', 'geometry',(select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTILINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: - type: double ARG: tolerance name: 容差 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "L06.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的线要素不能自相交或自叠置。任何存在要素自叠置的线都是错误的。" L07: note: "线不能自相交" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,idx,rulecode,geometry POINT); with t as( select createuuid(), ogc_fid as id, numGeometries(ST_SelfIntersections(geometry)) cnt, ST_SelfIntersections(geometry) geometry from @intable_s@ where ST_SelfIntersections(geometry) is not null), cte(UUID,idx, id,cnt,geometry,line) AS ( SELECT createuuid(), 1 idx, id, cnt, geometry, geometryN(geometry, 1) line from t UNION ALL SELECT createuuid(),idx + 1 idx, id, cnt,geometry, geometryN(geometry , idx +1 ) line FROM cte WHERE idx < cnt ) insert into @outtable@ SELECT null,UUID,id,idx,'L07' rulecode, line geometry FROM cte order by id, idx; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'POINT', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "L07.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的线要素不能自相交。任何存在要素自叠置的线或要素自相交的点都是错误的。" L08: note: "线不能相交或者内部相连" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtableP: meaning: 输出点错误表的名字 type: B - outtableL: meaning: 输出线错误表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } # RARG: [ '@intable_s@=输入表的名字','@outtableP@=输出点错误表的名字','@outtableL@=输出线错误表的名字' ] RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop view if exists L08view; create view L08view as select c.ogc_fid sid, d.ogc_fid did, numGeometries( intersection( c.geometry, d.geometry )) cnt, intersection( c.geometry, d.geometry ) geometry from idx_@intable_s@_geometry a, idx_@intable_s@_geometry b, @intable_s@ as c, @intable_s@ as d where a.rowid < b.rowid and (a.xmin < b.xmax and a.xmax > b.xmin and a.ymin < b.ymax and a.ymax > b.ymin) and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry ) and relate(c.geometry, d.geometry) not like 'FF_F0____'; drop table if exists @outtable@_P; create table @outtable@_P(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POINT); with t as (select sid,did,cnt, geometry geometry from L08view where geometrytype(geometry) like '%POINT') , cte as ( SELECT 1 idx, sid, did, cnt, geometry, geometryN(geometry, 1) line from t UNION ALL SELECT idx + 1 idx, sid, did,cnt,geometry, geometryN(geometry , idx + 1 ) line FROM cte WHERE idx < cnt ) insert into @outtable@_P select null,createuuid(),sid,did,'L08' rulecode,line geometry from cte order by sid, did, idx; select recovergeometrycolumn('@outtable@_P', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'POINT', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@')); drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTILINESTRING); insert into @outtable@ select null,createuuid(), sid,did, 'L08' rulecode, ExtractMultiLinestring(geometry) geometry from L08view where geometrytype(geometry) like '%LINESTRING' order by sid, did; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTILINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "L08.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的线必须在其端点处与同一图层中的其他线相接触。任何与要素叠置的线或任何相交点都是错误的。" L09: note: "线线相交交点处必须存在节点" lastupdated: [ 2024-11-22, ] roadmap: "存在问题,临时表创建为view无法建立索引,最后的判断无法进行" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists temp_points; create table temp_points(id integer, idx integer,geometry POINT); insert into temp_points(id, idx, geometry) WITH t as ( select ogc_fid id, numGeometries(DissolvePoints(geometry)) cnt, DissolvePoints(geometry) geometry from @intable_s@ ), cte(idx, id, cnt, geometry, point) AS ( SELECT 1 idx, id, cnt, geometry, geometryN(geometry, 1) point from t UNION ALL SELECT idx + 1 idx, id, cnt, geometry, geometryN(geometry, idx + 1) point FROM cte WHERE idx < cnt ) SELECT id, idx, point geometry FROM cte order by id, idx; select recovergeometrycolumn('temp_points', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'),'POINT', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@')); select CreateSpatialIndex('temp_points', 'geometry'); drop table if exists temp_points_other; create table temp_points_other(id integer, idx integer,geometry POINT); insert into temp_points_other(id, idx, geometry) WITH t as ( select c.ogc_fid id, numgeometries(ExtractMultiPoint(intersection(c.geometry, d.geometry))) cnt, ExtractMultiPoint(intersection(c.geometry, d.geometry)) geometry from idx_@intable_s@_geometry a, idx_@intable_s@_geometry b, @intable_s@ as c, @intable_s@ as d where a.rowid < b.rowid and ( a.xmin <= b.xmax and a.xmax >= b.xmin and a.ymin <= b.ymax and a.ymax >= b.ymin ) and a.rowid = c.rowid and b.rowid = d.rowid and crosses(c.geometry, d.geometry) = 1 and ExtractMultiPoint(intersection(c.geometry, d.geometry)) is not null ), cte(idx, id, cnt, geometry, point) AS ( SELECT 1 idx, id, cnt, geometry, geometryN(geometry, 1) point from t UNION ALL SELECT idx + 1 idx, id, cnt, geometry, geometryN(geometry, idx + 1) point FROM cte WHERE idx < cnt ) SELECT id, idx, point geometry FROM cte order by id, idx; select recovergeometrycolumn('temp_points_other', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'),'POINT', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@')); select CreateSpatialIndex('temp_points_other', 'geometry'); drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,idx,rulecode,geometry POINT); insert into @outtable@ select null,createuuid(),id, idx, 'L09' rulecode, geometry from temp_points_other where rowid not in ( select a.rowid from idx_temp_points_other_geometry a, idx_temp_points_geometry b where ( a.xmin < b.xmax and a.xmax > b.xmin and a.ymin < b.ymax and a.ymax > b.ymin )); select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'POINT', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "L09.png" icon: "processingAlgorithm.png" description: "说明:一个图层中的线如果存在相交的情况,那么在相交处必须存在节点。任何不存在节点的相交线都是错误的。" L10: note: "线节点距离必须大于聚合阈值" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - tolerance: meaning: 容差 type: f RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@tolerance@=容差','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,idx,length,rulecode,geometry LINESTRING); WITH t as ( select createuuid(), ogc_fid id, numGeometries(DissolveSegments(geometry)) cnt, DissolveSegments(geometry) geometry from @intable_s@ ), cte(UUID,idx, id, cnt, geometry, line) AS ( SELECT createuuid(), 1 idx, id, cnt, geometry, geometryN(geometry, 1) line from t UNION ALL SELECT createuuid(), idx + 1 idx, id, cnt, geometry, geometryN(geometry, idx + 1) line FROM cte WHERE idx < cnt ) insert into @outtable@ SELECT null,UUID, id, idx, st_length(transform(line,3857)) length, 'L10' rulecode, line geometry FROM cte where st_length(transform(line,3857)) < @tolerance@ order by id,idx; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'LINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: - type: double ARG: tolerance name: 容差 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "L10.png" icon: "processingAlgorithm.png" description: "说明: 线节点距离必须大于拓扑容差值,这样两个节点自动连接在一起,避免有缝隙出现。任何两个小于拓扑容差距离的线节点都是错误的。" A00: note: "面有效性检查" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry MULTIPOLYGON); insert into @outtable@ select null,createuuid(),ogc_fid sid,'A00' rulecode, geometry geometry from @intable_s@ where isvalid(geometry) <> 1; select recovergeometrycolumn('@outtable@','geometry',(select srid from geometry_columns where f_table_name = '@intable_s@') ,'MULTIPOLYGON',(select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "A00.png" icon: "processingAlgorithm.png" description: "说明: 面要素不能无效" A01: note: "面不能重叠" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POLYGON); with t as( select createuuid(),c.ogc_fid sid, d.ogc_fid did, numGeometries(intersection(c.geometry, d.geometry)) cnt, intersection(c.geometry, d.geometry) geometry from idx_@intable_s@_geometry a, idx_@intable_s@_geometry b, @intable_s@ as c, @intable_s@ as d where a.rowid < b.rowid and ( a.xmin < b.xmax and a.xmax > b.xmin and a.ymin < b.ymax and a.ymax > b.ymin ) and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry) = 1 and ST_Dimension(intersection(c.geometry, d.geometry)) > 1 ), cte(PIEUUID,idx, sid,did, cnt, geometry, subgeom) AS ( SELECT createuuid(), 1 idx, sid, did, cnt, geometry, geometryN(geometry, 1) subgeom from t UNION ALL SELECT PIEUUID, idx + 1 idx, sid, did, cnt, geometry, geometryN(geometry, idx + 1) subgeom FROM cte WHERE idx < cnt ) insert into @outtable@ SELECT null,PIEUUID,sid, 'A01' rulecode, subgeom geometry FROM cte where geometrytype(subgeom) = 'POLYGON' order by sid, did; select recovergeometrycolumn('@outtable@', 'geometry',(select srid from geometry_columns where f_table_name = '@intable_s@'), 'POLYGON', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "A01.png" icon: "processingAlgorithm.png" description: "说明: 一个区域不能与同一图层的另一个区域叠置。任何存在要素重叠的区域都是错误的。" A02: note: "面自身不能有内洞" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,ringNum,rulecode,geometry MULTIPOLYGON); insert into @outtable@ select null,createuuid(),ogc_fid sid, NumInteriorRing(geometry) ringNum, 'A02' rulecode, geometry geometry from @intable_s@ where NumInteriorRing(geometry) > 0 order by sid; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTIPOLYGON', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "A02.png" icon: "processingAlgorithm.png" description: "说明:一个区域内部不能出现空的情况。任何存在空的区域都是错误的。" A03: note: "面不能有空隙" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,idx,rulecode,geometry MULTILINESTRING); with t as( select 0 sid, 0 did, numgeometries(linesfromrings(gunion(geometry))) cnt, linesfromrings(gunion(geometry)) geometry from @intable_s@ ), cte(idx, sid, did, cnt, geometry, subgeom) AS ( SELECT 1 idx, sid, did, cnt, geometry, geometryN(geometry, 1) subgeom from t UNION ALL SELECT idx + 1 idx, sid, did, cnt, geometry, geometryN(geometry, idx + 1) subgeom FROM cte WHERE idx < cnt ) insert into @outtable@ SELECT null,createuuid(), sid, idx, 'A03' rulecode, casttomulti(subgeom) geometry FROM cte; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTILINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "A03.png" icon: "processingAlgorithm.png" description: "说明: 同一图层中的区域之间不能存在空隙。存在任何空隙的边界都是错误的。" A04: note: "面不能自相交" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry MULTIPOLYGON); insert into @outtable@ select null,createuuid(), ogc_fid sid, 'A04' rulecode, geometry geometry from @intable_s@ where ST_NumPoints(linesfromrings(geometry)) > 3 and ST_SelfIntersections(linesfromrings(geometry)) is not null; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTIPOLYGON', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@')); " UI: inparam: - type: vector ARG: intable_s name: 输入面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "A04.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的面要素不能自相交。任何存在要素自叠置的面或要素自相交的点都是错误的。" A05: note: "面节点距离必须大于聚合阈值" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - tolerance: meaning: 容差 type: f RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@tolerance@=容差','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,idx,length,rulecode,geometry LINESTRING); WITH t as ( select createuuid(),ogc_fid id, numGeometries(DissolveSegments(geometry)) cnt, DissolveSegments(geometry) geometry from @intable_s@ ), cte(UUID,idx, id, cnt, geometry, line) AS ( SELECT createuuid(), 1 idx, id, cnt, geometry, geometryN(geometry, 1) line from t UNION ALL SELECT createuuid(), idx + 1 idx, id, cnt, geometry, geometryN(geometry, idx + 1) line FROM cte WHERE idx < cnt ) insert into @outtable@ SELECT null,UUID, id, idx, st_length(transform(line,3857)) length, 'A05' rulecode, line geometry FROM cte where st_length(transform(line,3857)) < @tolerance@ order by id, idx; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'LINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入面图层 description: defaultValue: help: - type: double ARG: tolerance name: 容差 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "A05.png" icon: "processingAlgorithm.png" description: "说明: 面节点距离必须大于容差值,这样两个节点自动连接在一起,避免多边形有缝隙出现。任何两个小于容差距离的节点都是错误的。" PP01: note: "点必须被其他要素类覆盖(点-点)" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POINT); insert into @outtable@ select null,createuuid(),ogc_fid sid,'PP01' rulecode, geometry from @intable_s@ where rowid not in (select a.rowid from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where (a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax) and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry) and geometrytype(c.geometry) = 'POINT' and geometrytype(d.geometry) = 'POINT'); select recovergeometrycolumn('@outtable@', 'geometry',(select srid from geometry_columns where f_table_name = '@intable_s@'), 'POINT',(select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入点图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标点图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "PP01.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的点要素必须被另一个图层中的点要素重合。第一个图层中未被第二个图层中的点覆盖的任何点都是错误的。" PP02: note: "点不与其他要素点重合(点-点)" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,count,rulecode,geometry POINT); with t as ( select createuuid() uuid,c.ogc_fid sid, count(1) count, 'PP02' rulecode, c.geometry geometry from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where (a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax) and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry) and geometrytype(c.geometry) = 'POINT' and geometrytype(d.geometry) = 'POINT' group by c.ogc_fid) insert into @outtable@ select null,uuid,sid,count,rulecode,geometry from t; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'POINT', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入点图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标点图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "PP02.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的点要素不与另一个图层中的点要素重合。第一个图层中被第二个图层中的点覆盖的任何点都是错误的。" PL01: note: "点必须被其他要素类的端点覆盖(点-线)" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POINT); insert into @outtable@ select null,createuuid(), ogc_fid sid, 'PL01' rulecode, geometry from @intable_s@ where rowid not in( select a.rowid from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and touches(c.geometry, d.geometry) ); select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'POINT', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入点图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "PL01.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的点要素必须被另一个图层的线要素的端点覆盖。如果点图层中的要素未落在线要素端点上,则是错误的。" PL02: note: "点必须被线覆盖(点-线)" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POINT); insert into @outtable@ select null,createuuid(), ogc_fid sid, 'PL02' rulecode, geometry from @intable_s@ where rowid not in( select a.rowid from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry) and not touches(c.geometry, d.geometry) ); select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'POINT', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入点图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "PL02.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的点要素必须被另一个图层中的线要素覆盖。任何未被线要素覆盖的点都是错误的。" PA01: note: "点必须被其他要素的边界覆盖(点-面)" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POINT); insert into @outtable@ select null,createuuid(), ogc_fid sid, 'PA01' rulecode, geometry from @intable_s@ where rowid not in( select a.rowid from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and touches(c.geometry, d.geometry) ); select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'POINT', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入点图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "PA01.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的点要素必须与另一个图层中面要素的边界重合。如果点图层中的要素未落在边界上,则它是错误的。" PA02: note: "点必须完全位于面内部(点-面)" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POINT); insert into @outtable@ select null,createuuid(), ogc_fid sid, 'PA02' rulecode, geometry from @intable_s@ where rowid not in( select a.rowid from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and within(c.geometry, d.geometry) and not touches(c.geometry, d.geometry) ); select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'POINT', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入点图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "PA02.png" icon: "processingAlgorithm.png" description: "说明:一个图层中的点要素必须完全位于另一个图层的面要素内。未在面要素内的任何点都是错误的。" PA03: note: "点不在面内部或边界(点-面)" lastupdated: [ 2024-11-22, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POINT); with t as ( select createuuid() uuid, c.ogc_fid sid, group_concat(d.ogc_fid, '-') did,'PA03' rulecode,c.geometry geometry from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry) group by c.ogc_fid) insert into @outtable@ select null,uuid,sid,did,rulecode,geometry from t; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'POINT', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入点图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "PA03.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的点要素不能位于另一个图层的面要素内部或边界。在面要素内部和边界的任何点都是错误的。" LP01: note: "线端点必须被其他要素覆盖(线-点)" lastupdated: [ 2023-1-4, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry LINESTRING); insert into @outtable@ select null,createuuid(), ogc_fid sid, 'LP01' rulecode, geometry geometry from @intable_s@ where rowid not in( select rowid from ( select a.rowid,count(*) cnt from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and touches(c.geometry, d.geometry) group by a.rowid having cnt > 1) ); select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTILINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标点图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "LP01.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中线的端点必须被另一个图层中的点要素覆盖。任何未被点要素覆盖的端点都是错误的。" LL01: note: "线不能与其他要素线相交(线-线)" lastupdated: [ 2023-1-4, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POINT); with t as ( select c.ogc_fid id, numGeometries(intersection(c.geometry, d.geometry)) cnt, intersection(c.geometry, d.geometry) geometry from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and crosses(c.geometry, d.geometry) ), cte(idx, id, cnt, geometry, line) AS ( SELECT 1 idx, id, cnt, geometry, geometryN(geometry, 1) line from t UNION ALL SELECT idx + 1 idx, id, cnt, geometry, geometryN(geometry, idx + 1) line FROM cte WHERE idx < cnt ) insert into @outtable@ SELECT null,createuuid(), id sid, idx did, 'LL01' rulecode, line geometry FROM cte order by id, idx; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'POINT', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "LL01.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的线不能与另一个图层中的线相交。第二个图层中的要素与第一个图层中的要素相交的任何线都是错误的。" LL02: note: "线必须被其他要素类的要素覆盖(线-线)" lastupdated: [ 2023-1-4, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop view if exists LL02view; create view LL02view as select c.ogc_fid sid,c.geometry cg, d.ogc_fid did, d.geometry dg from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry) order by c.ogc_fid; drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry MULTILINESTRING); with sel as ( select sid from LL02view where overlaps(cg,dg) union select ogc_fid from @intable_s@ where ogc_fid not in( SELECT sid FROM LL02view where equals(cg, dg) or overlaps(cg, dg) ) ), t as ( select c.ogc_fid sid,c.geometry cg, d.ogc_fid did, d.geometry dg from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where c.ogc_fid in sel and a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid order by sid, did ),u as ( select sid, st_difference(cg , gunion(dg) ) geom from t group by sid ) insert into @outtable@ select null,createuuid(),sid,'LL02' rulecode, ExtractMultiLinestring(geom) geometry from u where ExtractMultiLinestring(geom) is not null; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTILINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "LL02.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的线必须与另一个图层中的线重合。第一个图层中有任何线未与第二个图层的线重合都是错误的。" LL03: note: "线不能与其他要素重叠(线-线)" lastupdated: [ 2023-1-4, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTILINESTRING); with t as ( select c.ogc_fid sid, d.ogc_fid did, 'LL03' rulecode, ExtractMultiLinestring(intersection(c.geometry, d.geometry)) geometry from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry) = 1 and ST_Dimension(intersection(c.geometry,d.geometry)) = 1) insert into @outtable@ select null,createuuid(),sid,did,rulecode,geometry from t; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTILINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "LL03.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的线不能与另一个图层中的线重叠。第二个图层中的要素与第一个图层中的要素重叠处的任何线都是错误的。" LL04: note: "线不能与其他要素相交或内部相连" lastupdated: [ 2023-1-4, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtableP: meaning: 输出点错误表的名字 type: B - outtableL: meaning: 输出线错误表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出错误表的名字' ] RUNTYPE: repl ALG: "drop view if exists LL04view; create view LL04view as select c.ogc_fid sid, d.ogc_fid did, numGeometries( intersection( c.geometry, d.geometry )) cnt, intersection( c.geometry, d.geometry ) geometry from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ as c, @intable_t@ as d where (a.xmin < b.xmax and a.xmax > b.xmin and a.ymin < b.ymax and a.ymax > b.ymin) and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry ) and relate(c.geometry, d.geometry) not like 'FF_F0____'; drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTILINESTRING); insert into @outtable@ select null,createuuid(),sid,did, 'LL04' rulecode, ExtractMultiLinestring(geometry) geometry from LL04view where geometrytype(geometry) like '%LINESTRING' order by sid, did; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTILINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "LL04.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的线只能在其端点处与另一图层中的线相接触。任何与要素叠置的线或任何交叉点都是错误的。" LA01: note: "线必须完全位于面内部" lastupdated: [ 2023-1-4, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry LINESTRING); insert into @outtable@ select null,createuuid(), ogc_fid sid, 'LA01' rulecode, geometry geometry from @intable_s@ where rowid not in( select a.rowid from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and within(c.geometry, d.geometry) = 1 and touches(c.geometry, linesfromrings(d.geometry) <> 1) ); select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTILINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "LA01.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的线必须包含在另一个图层的面要素内。第一个图层中未包含在第二个图层面要素内的任何线都是错误的。" LA02: note: "线必须被其他要素的边界覆盖" lastupdated: [ 2023-1-4, ] roadmap: "结果创建的是table而不是view" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop view if exists LA02view; create view LA02view as select c.ogc_fid sid,c.geometry cg, d.ogc_fid did, linesfromrings(d.geometry) dg from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, linesfromrings(d.geometry)) and relate(c.geometry, linesfromrings(d.geometry)) like '1%' order by c.ogc_fid; drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTILINESTRING); with t1 as ( select sid, group_concat(did, '-') did, 'LA02' rulecode, ExtractMultiLinestring(st_difference(cg, gunion(dg))) geometry from LA02view group by sid having geometry is not null) insert into @outtable@ select null,createuuid(),sid,did,rulecode,geometry from t1; with t2 as ( select createuuid(),ogc_fid sid, null did, 'LA02' rulecode , ExtractMultiLinestring(geometry) geometry from @intable_s@ where ogc_fid not in (select sid from LA02view)) insert into @outtable@ select null,createuuid(),sid,did,rulecode,geometry from t2; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTILINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "LA02.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的线要素必须与另一个图层面要素的边界重合。线图层要素中与面图层边界不重合的任何线都是错误的。" LA03: note: "线不能与面重叠" lastupdated: [ 2023-1-4, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTILINESTRING); with t as( select c.ogc_fid sid, d.ogc_fid did, 'LA03' rulecode, ExtractMultiLinestring(intersection(c.geometry, d.geometry) ) geometry from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and ( crosses(c.geometry, d.geometry) or within(c.geometry, d.geometry) ) and ExtractMultiLinestring(intersection(c.geometry, d.geometry) ) is not null) insert into @outtable@ select null,createuuid(),sid,did,rulecode,geometry from t; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTILINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入线图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "LA03.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的线不能与另一个图层中的面重叠。第二个图层中的要素与第一个图层中的要素重叠处的任何区域都是错误的。" AP01: note: "面必须包含点" lastupdated: [ 2023-1-4, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POLYGON); insert into @outtable@ select null,createuuid(), ogc_fid sid, 'AP01' rulecode, geometry geometry from @intable_s@ where rowid not in( select a.rowid from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and contains(c.geometry, d.geometry) = 1 order by a.rowid ); select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTIPOLYGON', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入面图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标点图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "AP01.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的面要素必须至少包含另一个图层中的一个点要素。任何不包含至少一个点要素的面要素都是错误的。" AP02: note: "面只能包含一个点(面的内部的点个数不是1(0,2...))" lastupdated: [ 2023-1-4, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POLYGON); insert into @outtable@ select null,createuuid(), ogc_fid sid, 'AP02' rulecode, geometry geometry from @intable_s@ where rowid not in( select c.rowid sid from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where ( b.xmax >= a.xmin and b.xmin <= a.xmax and b.ymax >= a.ymin and b.ymin <= a.ymax ) and a.rowid = c.rowid and b.rowid = d.rowid and contains(c.geometry, d.geometry) = 1 group by sid having count(d.rowid) = 1 ); select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTIPOLYGON', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入面图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标点图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "AP02.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的面要素必须完全包含另一个图层中的一个点要素。任何未完全包含一个点要素的面要素都是错误的。" AL01: note: "面边界必须被其他要素覆盖(面-线)" lastupdated: [ 2023-1-4, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry MULTILINESTRING); with t1 as( select c.ogc_fid sid,linesfromrings(c.geometry) cg, d.ogc_fid did, d.geometry dg from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and intersects(linesfromrings(c.geometry), d.geometry) and ST_Dimension(intersection(linesfromrings(c.geometry), d.geometry)) = 1 order by c.ogc_fid, d.ogc_fid ) , t2 as( select sid,'AL01' rulecode, casttomulti(st_difference(cg, gunion(dg))) geometry from t1 group by sid) insert into @outtable@ select null,createuuid(), sid,rulecode,geometry from t2 where geometry is not null; insert into @outtable@ select null,createuuid(), ogc_fid sid,'AL01' rulecode, casttomulti(linesfromrings(geometry)) geometry from @intable_s@ where rowid not in( select c.rowid sid from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and intersects(linesfromrings(c.geometry), d.geometry) and ST_Dimension(intersection(linesfromrings(c.geometry), d.geometry)) = 1 order by c.rowid, d.rowid ); select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTILINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入面图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标线图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "AL01.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中面要素的边界必须被另一个图层的线要素覆盖。未与线要素重合的面要素边界是错误的。" AA01: note: "面不与其他要素重叠(面-面)" lastupdated: [ 2023-1-4, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POLYGON); with t as( select c.ogc_fid sid, d.ogc_fid did, numGeometries(intersection(c.geometry, d.geometry)) cnt, intersection(c.geometry, d.geometry) geometry from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ as c, @intable_t@ as d where ( a.xmin < b.xmax and a.xmax > b.xmin and a.ymin < b.ymax and a.ymax > b.ymin ) and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry) = 1 and ST_Dimension(intersection(c.geometry, d.geometry)) > 1 ), cte(idx, sid, did, cnt, geometry, subgeom) AS ( SELECT 1 idx, sid, did, cnt, geometry, geometryN(geometry, 1) subgeom from t UNION ALL SELECT idx + 1 idx, sid, did, cnt, geometry, geometryN(geometry, idx + 1) subgeom FROM cte WHERE idx < cnt ) insert into @outtable@ SELECT null,createuuid(), sid, did, 'AA01' rulecode, subgeom geometry FROM cte where geometrytype(subgeom) = 'POLYGON' order by sid, did; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'POLYGON', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入面图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "AA01.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中的区域不能与另一个图层中的区域重叠。第二个图层中的要素与第一个图层中的要素重叠处的任何区域都是错误的。" AA02: note: "面必须被其他要素类的要素覆盖" lastupdated: [ 2023-1-4, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop view if exists AA02view; create view AA02view as select c.ogc_fid cid, d.ogc_fid did, c.geometry cg, d.geometry dg from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry); drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTIPOLYGON); insert into @outtable@ select null,createuuid(),cid sid, ids did, 'AA02' rilecode, geom geometry from ( select cid, group_concat(did, '-') ids, ExtractMultiPolygon(ST_Difference(cg, gunion(dg))) geom from AA02view group by cid ) where geom is not null; insert into @outtable@ select null,createuuid(),ogc_fid sid, null did, 'AA02' rulecode, casttomulti(geometry) geometry from @intable_s@ where ogc_fid not in (select cid from AA02view); select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTIPOLYGON', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入面图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "AA02.png" icon: "processingAlgorithm.png" description: "说明: 一个图层的面要素必须覆盖另一个图层的面要素。如果任何区域中第一个图层中的要素没有被第二个图层中的要素覆盖,该区域都是错误的。" AA03: note: "面必须互相覆盖" lastupdated: [ 2023-1-4, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop view if exists AA03view; create view AA03view as select c.ogc_fid cid, d.ogc_fid did, c.geometry cg, d.geometry dg from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry) and not touches(c.geometry, d.geometry); drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTIPOLYGON); insert into @outtable@ select null,createuuid(), cid sid, ids did, 'AA03' rilecode, geom geometry from ( select cid, group_concat(did, '-') ids, ExtractMultiPolygon(ST_Difference(cg, gunion(dg))) geom from AA03view group by cid ) where geom is not null; insert into @outtable@ select null,createuuid(),ids sid, did ,'AA03' rilecode, geom geometry from ( select did, group_concat(cid, '-') ids, ExtractMultiPolygon(ST_Difference(dg, gunion(cg))) geom from AA03view group by did ) where geom is not null; insert into @outtable@ select null,createuuid(), ogc_fid sid, null did, 'AA03' rulecode, casttomulti(geometry) geometry from @intable_s@ where ogc_fid not in (select cid from AA03view); insert into @outtable@ select null,createuuid(),null sid, ogc_fid did, 'AA03' rulecode, casttomulti(geometry) geometry from @intable_t@ where ogc_fid not in (select did from AA03view); select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTIPOLYGON', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入面图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "AA03.png" icon: "processingAlgorithm.png" description: "说明: 一个图层的面要素必须与另一个图层的面要素互相覆盖。如果在任何区域中一个图层的要素未覆盖另一个图层的要素,该区域都是错误的。" AA04: note: "面必须被单个面覆盖(村必须在某个乡镇之内)" lastupdated: [ 2023-1-4, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POLYGON); insert into @outtable@ select null,createuuid(), ogc_fid sid, 'AA04' rulecode, geometry geometry from @intable_s@ where rowid not in( select a.rowid from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and intersects(c.geometry, d.geometry) and within(c.geometry, d.geometry) ); select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'POLYGON', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入面图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "AA04.png" icon: "processingAlgorithm.png" description: "说明:一个图层中的面要素必须包含在另一个图层的面要素内。第一个图层中的任何面要素未包含在第二个图层的要素内都是错误的。" AA05: note: "面边界必须被其他要素边界覆盖(面-面)" lastupdated: [ 2023-1-4, ] roadmap: "" front: [ ] ARG: - intable_s: meaning: 输入表的名字 type: B - intable_t: meaning: 目标表的名字 type: B RTN: - outtable: meaning: 输出表的名字 type: B DRTN: { meaning: 正确执行返回1, type: int } RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ] RUNTYPE: repl ALG: "drop view if exists AA05view; create view AA05view as select c.ogc_fid sid,linesfromrings(c.geometry) cg, d.ogc_fid did, linesfromrings(d.geometry) dg from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid and intersects(linesfromrings(c.geometry), linesfromrings(d.geometry)) order by c.ogc_fid; drop table if exists @outtable@; create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry MULTILINESTRING); with sel as ( select sid from AA05view where overlaps(cg,dg) union select ogc_fid from @intable_s@ where ogc_fid not in( SELECT sid FROM AA05view where equals(cg, dg) or overlaps(cg, dg) ) ), t as ( select c.ogc_fid sid,linesfromrings(c.geometry) cg, d.ogc_fid did, linesfromrings(d.geometry) dg from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d where c.ogc_fid in sel and a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax and a.rowid = c.rowid and b.rowid = d.rowid order by sid, did ),u as ( select sid, st_difference(cg , gunion(dg) ) geom from t group by sid ) insert into @outtable@ select null,createuuid(),sid,'AA05' rulecode, ExtractMultiLinestring(geom) geometry from u where ExtractMultiLinestring(geom) is not null; select recovergeometrycolumn('@outtable@', 'geometry', (select srid from geometry_columns where f_table_name = '@intable_s@'), 'MULTILINESTRING', (select case when coord_dimension == 2 then 'XY' else 'XYZ' end from geometry_columns where f_table_name = '@intable_s@'));" UI: inparam: - type: vector ARG: intable_s name: 输入面图层 description: defaultValue: help: - type: vector ARG: intable_t name: 目标面图层 description: defaultValue: help: outparam: - type: databasetable ARG: outtable name: 输出结果表 description: fileFilter: "gsf;;shp;;spa" defaultValue: newTable help: "" parentLayerParameterName: intable_s image: "AA05.png" icon: "processingAlgorithm.png" description: "说明: 一个图层中面要素的边界必须被另一个图层中面要素的边界覆盖。第一个图层中任何未被第二个图层中面要素的边界覆盖的面要素边界都是错误的。"