topoCheck.yaml 114 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016
  1. version:
  2. provider: 四维数码研发部
  3. lastupdated: [ 2024-11-22, ]
  4. name: 拓扑检查
  5. topoCheck:
  6. P00:
  7. note: "点图层有效性"
  8. lastupdated: [ 2024-11-22, ]
  9. roadmap: ""
  10. front: [ ]
  11. ARG:
  12. - intable_s:
  13. meaning: 输入表的名字
  14. type: B
  15. RTN:
  16. - outtable:
  17. meaning: 输出表的名字
  18. type: B
  19. DRTN: { meaning: 正确执行返回1, type: int }
  20. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ]
  21. RUNTYPE: repl
  22. ALG: "drop table if exists @outtable@;
  23. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode, geometry POINT);
  24. insert into @outtable@
  25. select null,createuuid(),ogc_fid sid,'P00' rulecode, geometry
  26. from @intable_s@ where geometrytype(geometry) = 'POINT' and isvalid(geometry) <> 1;
  27. 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@'));
  28. "
  29. UI:
  30. inparam:
  31. - type: vector
  32. ARG: intable_s
  33. name: 输入点图层
  34. description:
  35. defaultValue:
  36. help:
  37. outparam:
  38. - type: databasetable
  39. ARG: outtable
  40. name: 输出结果表
  41. description:
  42. fileFilter: "gsf;;shp;;spa"
  43. defaultValue: newTable
  44. help: ""
  45. parentLayerParameterName: intable_s
  46. image: "P00.png"
  47. icon: "processingAlgorithm.png"
  48. description: "说明:点要素不能无效。"
  49. P01:
  50. note: "点必须不能相交(单点)"
  51. lastupdated: [ 2024-11-22, ]
  52. roadmap: ""
  53. front: [ ]
  54. ARG:
  55. - intable_s:
  56. meaning: 输入表的名字
  57. type: B
  58. RTN:
  59. - outtable:
  60. meaning: 输出表的名字
  61. type: B
  62. DRTN: { meaning: 正确执行返回1, type: int }
  63. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ]
  64. RUNTYPE: repl
  65. ALG: "drop table if exists @outtable@;
  66. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POINT);
  67. with t as(
  68. select createuuid(),c.ogc_fid sid, d.ogc_fid did,'P01' rulecode, c.geometry geometry
  69. from idx_@intable_s@_geometry a, idx_@intable_s@_geometry b, @intable_s@ c, @intable_s@ d
  70. where a.rowid < b.rowid
  71. and (a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax)
  72. and a.rowid = c.rowid and b.rowid = d.rowid
  73. and intersects(c.geometry, d.geometry)
  74. and geometrytype(c.geometry) = 'POINT'
  75. and geometrytype(d.geometry) = 'POINT')
  76. insert into @outtable@
  77. select null,createuuid(),sid,did,rulecode,geometry from t;
  78. 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@'));"
  79. UI:
  80. inparam:
  81. - type: vector
  82. ARG: intable_s
  83. name: 输入点图层
  84. description:
  85. defaultValue:
  86. help:
  87. outparam:
  88. - type: databasetable
  89. ARG: outtable
  90. name: 输出结果表
  91. description:
  92. fileFilter: "gsf;;shp;;spa"
  93. defaultValue: newTable
  94. help: ""
  95. parentLayerParameterName: intable_s
  96. image: "P01.png"
  97. icon: "processingAlgorithm.png"
  98. description: "说明:一个图层中的点要素不能与同一图层中的点要素重合。被另一个点覆盖的任何点都是错误的。"
  99. L00:
  100. note: "线图层有效性"
  101. lastupdated: [ 2024-11-22, ]
  102. roadmap: ""
  103. front: [ ]
  104. ARG:
  105. - intable_s:
  106. meaning: 输入表的名字
  107. type: B
  108. RTN:
  109. - outtable:
  110. meaning: 输出表的名字
  111. type: B
  112. DRTN: { meaning: 正确执行返回1, type: int }
  113. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ]
  114. RUNTYPE: repl
  115. ALG: "drop table if exists @outtable@;
  116. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode, geometry MULTILINESTRING);
  117. insert into @outtable@
  118. select null,createuuid(),ogc_fid sid,'L00' rulecode, geometry geometry
  119. from @intable_s@ where isvalid(geometry) <> 1;
  120. 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@'));"
  121. UI:
  122. inparam:
  123. - type: vector
  124. ARG: intable_s
  125. name: 输入线图层
  126. description:
  127. defaultValue:
  128. help:
  129. outparam:
  130. - type: databasetable
  131. ARG: outtable
  132. name: 输出结果表
  133. description:
  134. fileFilter: "gsf;;shp;;spa"
  135. defaultValue: newTable
  136. help: ""
  137. parentLayerParameterName: intable_s
  138. image: "L00.png"
  139. icon: "processingAlgorithm.png"
  140. description: "说明:线要素不能无效"
  141. L01:
  142. note: "线不能有悬挂点"
  143. lastupdated: [ 2024-11-22, ]
  144. roadmap: ""
  145. front: [ ]
  146. ARG:
  147. - intable_s:
  148. meaning: 输入表的名字
  149. type: B
  150. RTN:
  151. - outtable:
  152. meaning: 输出表的名字
  153. type: B
  154. DRTN: { meaning: 正确执行返回1, type: int }
  155. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ]
  156. RUNTYPE: repl
  157. ALG: "drop table if exists @outtable@;
  158. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POINT);
  159. with d as (
  160. select createuuid(), ogc_fid,
  161. 'e' || ogc_fid flag,
  162. startpoint(geometry) geometry
  163. from @intable_s@ where not isring(geometry)
  164. union
  165. select createuuid(), ogc_fid,
  166. 'e' || ogc_fid flag,
  167. endpoint(geometry)
  168. from @intable_s@ where not isring(geometry)
  169. ),
  170. u as (
  171. select d.ogc_fid sid,flag,
  172. g.ogc_fid did,
  173. intersection(d.geometry, g.geometry) geometry
  174. from d,
  175. idx_@intable_s@_geometry t,
  176. @intable_s@ as g
  177. where X(d.geometry) between t.xmin and t.xmax
  178. and Y(d.geometry) between t.ymin and t.ymax
  179. and t.rowid = g.rowid
  180. and intersects(d.geometry, g.geometry) = 1
  181. and d.ogc_fid <> g.ogc_fid
  182. union
  183. select ogc_fid,
  184. 's' || ogc_fid flag,
  185. null did,
  186. startpoint(geometry) geometry
  187. from @intable_s@
  188. where numpoints(geometry) > 2
  189. and intersects(startpoint(geometry), removepoint(geometry, 0)) = 1
  190. and not isring(geometry)
  191. union
  192. select ogc_fid,
  193. 'e' || ogc_fid flag,
  194. null did,
  195. endpoint(geometry) geometry
  196. from @intable_s@
  197. where numpoints(geometry) > 2
  198. and intersects(
  199. endpoint(geometry),
  200. removepoint(geometry, numpoints(geometry) -1)
  201. ) = 1
  202. and not isring(geometry)
  203. )
  204. insert into @outtable@
  205. select null,createuuid(),ogc_fid sid, flag did, 'L01' rulecode, geometry
  206. from d
  207. where flag not in (select flag from u);
  208. 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@'));"
  209. UI:
  210. inparam:
  211. - type: vector
  212. ARG: intable_s
  213. name: 输入线图层
  214. description:
  215. defaultValue:
  216. help:
  217. outparam:
  218. - type: databasetable
  219. ARG: outtable
  220. name: 输出结果表
  221. description:
  222. fileFilter: "gsf;;shp;;spa"
  223. defaultValue: newTable
  224. help: ""
  225. parentLayerParameterName: intable_s
  226. image: "L01.png"
  227. icon: "processingAlgorithm.png"
  228. description: "说明:一个图层中的线必须在两个端点处与同一图层中的其他线接触。线的任何端点未与其他线接触都是错误的。"
  229. L02:
  230. note: "线不能有伪节点"
  231. lastupdated: [ 2024-11-22, ]
  232. roadmap: ""
  233. front: [ ]
  234. ARG:
  235. - intable_s:
  236. meaning: 输入表的名字
  237. type: B
  238. RTN:
  239. - outtable:
  240. meaning: 输出表的名字
  241. type: B
  242. DRTN: { meaning: 正确执行返回1, type: int }
  243. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ]
  244. RUNTYPE: repl
  245. ALG: "drop table if exists @outtable@;
  246. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POINT);
  247. with t as
  248. (
  249. select PIEUUID, sid, did, rulecode, geometry from
  250. (
  251. select PIEUUID, id1 sid,id2 did,'L02' rulecode, inter geometry from
  252. (
  253. select PIEUUID, id1, group_concat( casttotext( within(inter, gc) + within(inter, gd) ) , '_') id2 , inter
  254. from
  255. (
  256. select createuuid() PIEUUID, c.ogc_fid id1, d.ogc_fid id2,c.geometry gc, d.geometry gd,
  257. intersection(c.geometry, d.geometry) inter
  258. from idx_@intable_s@_geometry a, idx_@intable_s@_geometry b, @intable_s@ c, @intable_s@ d
  259. where a.rowid < b.rowid
  260. and (a.xmin < b.xmax and a.xmax > b.xmin and a.ymin < b.ymax and a.ymax > b.ymin)
  261. and a.rowid = c.rowid and b.rowid = d.rowid
  262. and touches(c.geometry, d.geometry)
  263. ) t1
  264. group by inter
  265. ) t2
  266. where geometrytype( inter ) = 'POINT' and id2='0'
  267. union
  268. select createuuid(),ogc_fid sid, null did ,'L02' rulecode, startpoint(geometry) geometry
  269. from @intable_s@
  270. where not isring(geometry) and st_npoints(geometry) > 2
  271. and touches( startpoint(geometry), removepoint(geometry, 0) ) = 1
  272. union
  273. select createuuid(), ogc_fid sid, null did ,'L02' rulecode, endpoint(geometry) geometry
  274. from @intable_s@
  275. where not isring(geometry) and st_npoints(geometry) > 2
  276. and touches( endpoint(geometry), removepoint(geometry, st_npoints(geometry)-1 ) ) = 1
  277. order by id1))
  278. insert into @outtable@
  279. select null,createuuid(),sid,did,rulecode,geometry from t;
  280. 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@'));"
  281. UI:
  282. inparam:
  283. - type: vector
  284. ARG: intable_s
  285. name: 输入线图层
  286. description:
  287. defaultValue:
  288. help:
  289. outparam:
  290. - type: databasetable
  291. ARG: outtable
  292. name: 输出结果表
  293. description:
  294. fileFilter: "gsf;;shp;;spa"
  295. defaultValue: newTable
  296. help: ""
  297. parentLayerParameterName: intable_s
  298. image: "L02.png"
  299. icon: "processingAlgorithm.png"
  300. description: "说明: 一个图层中的线必须在其端点处与同一图层中的多条线接触。线的任何端点仅与一条其他线接触都是错误的。"
  301. L03:
  302. note: "线必须为单一部分"
  303. lastupdated: [ 2024-11-22, ]
  304. roadmap: ""
  305. front: [ ]
  306. ARG:
  307. - intable_s:
  308. meaning: 输入表的名字
  309. type: B
  310. RTN:
  311. - outtable:
  312. meaning: 输出表的名字
  313. type: B
  314. DRTN: { meaning: 正确执行返回1, type: int }
  315. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ]
  316. RUNTYPE: repl
  317. ALG: "drop table if exists @outtable@;
  318. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry MULTILINESTRING);
  319. insert into @outtable@
  320. select null,createuuid(),ogc_fid sid,'L03' rulecode, casttomulti(geometry) geometry from @intable_s@
  321. where geometry is not null and casttosingle(geometry) is null;
  322. 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@'));"
  323. UI:
  324. inparam:
  325. - type: vector
  326. ARG: intable_s
  327. name: 输入线图层
  328. description:
  329. defaultValue:
  330. help:
  331. outparam:
  332. - type: databasetable
  333. ARG: outtable
  334. name: 输出结果表
  335. description:
  336. fileFilter: "gsf;;shp;;spa"
  337. defaultValue: newTable
  338. help: ""
  339. parentLayerParameterName: intable_s
  340. image: "L03.png"
  341. icon: "processingAlgorithm.png"
  342. description: "说明:一个图层中的线要素不能具有一个以上的构成部分。任何具有超过一个构成部分的线要素都是错误的。"
  343. L04:
  344. note: "线不能重叠(线)"
  345. lastupdated: [ 2024-11-22, ]
  346. roadmap: ""
  347. front: [ ]
  348. ARG:
  349. - intable_s:
  350. meaning: 输入表的名字
  351. type: B
  352. RTN:
  353. - outtableP:
  354. meaning: 输出点错误表的名字
  355. type: B
  356. - outtableL:
  357. meaning: 输出线错误表的名字
  358. type: B
  359. DRTN: { meaning: 正确执行返回1, type: int }
  360. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出错误表的名字' ]
  361. RUNTYPE: repl
  362. ALG: "drop view if exists tempTableC;
  363. create view tempTableC as
  364. WITH cte(idx, sid, did,cnt,geometry,point) AS
  365. (
  366. SELECT 1 idx, sid, did ,cnt, geometry, geometryN(geometry, 1) point from
  367. (
  368. select c.ogc_fid sid, d.ogc_fid did,numGeometries(intersection(c.geometry, d.geometry)) cnt,
  369. intersection(c.geometry, d.geometry) geometry
  370. from idx_@intable_s@_geometry a,idx_@intable_s@_geometry b, @intable_s@ c, @intable_s@ d
  371. where a.rowid < b.rowid
  372. and (a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax)
  373. and a.rowid = c.rowid and b.rowid = d.rowid
  374. and intersects(c.geometry, d.geometry) = 1 and overlaps(c.geometry, d.geometry) = 1
  375. ) t
  376. UNION ALL
  377. SELECT idx + 1 idx, sid, did, cnt,geometry, geometryN(geometry , idx +1 ) point FROM cte
  378. WHERE idx < cnt
  379. )
  380. SELECT sid, did, case geometrytype(casttomulti( point)) when 'MULTIPOINT' then '0' when 'MULTILINESTRING' then '1' end as rulecode,
  381. casttomulti( point) geometry
  382. FROM cte;
  383. drop table if exists @outtable@;
  384. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTILINESTRING);
  385. insert into @outtable@
  386. SELECT null,createuuid(),sid, did, 'L04' rulecode, geometry
  387. FROM tempTableC where rulecode = '1';
  388. 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@'));"
  389. UI:
  390. inparam:
  391. - type: vector
  392. ARG: intable_s
  393. name: 输入线图层
  394. description:
  395. defaultValue:
  396. help:
  397. outparam:
  398. - type: databasetable
  399. ARG: outtable
  400. name: 输出结果表
  401. description:
  402. fileFilter: "gsf;;shp;;spa"
  403. defaultValue: newTable
  404. help: ""
  405. parentLayerParameterName: intable_s
  406. image: "L04.png"
  407. icon: "processingAlgorithm.png"
  408. description: "说明:一个图层中的线不能与同一图层中的线重叠。任何重叠的线都是错误的。"
  409. L05:
  410. note: "线不能相交(线)"
  411. lastupdated: [ 2024-11-22, ]
  412. roadmap: ""
  413. front: [ ]
  414. ARG:
  415. - intable_s:
  416. meaning: 输入表的名字
  417. type: B
  418. RTN:
  419. - outtable:
  420. meaning: 输出表的名字
  421. type: B
  422. DRTN: { meaning: 正确执行返回1, type: int }
  423. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ]
  424. RUNTYPE: repl
  425. ALG: "drop table if exists @outtable@;
  426. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POINT);
  427. with t as
  428. (
  429. select createuuid(),c.ogc_fid sid, d.ogc_fid did,
  430. numGeometries(ExtractMultiPoint(intersection(c.geometry, d.geometry))) cnt,
  431. ExtractMultiPoint(intersection(c.geometry, d.geometry)) geometry
  432. from idx_@intable_s@_geometry a,idx_@intable_s@_geometry b, @intable_s@ c, @intable_s@ d
  433. where a.rowid < b.rowid
  434. and (a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax)
  435. and a.rowid = c.rowid and b.rowid = d.rowid
  436. and intersects(c.geometry, d.geometry) = 1 and crosses(c.geometry, d.geometry) = 1
  437. and ExtractMultiPoint(intersection(c.geometry, d.geometry)) is not null
  438. ),
  439. cte(PIEUUID,idx, sid, did, cnt,geometry,line) AS
  440. (
  441. SELECT createuuid(),1 idx, sid, did,cnt, geometry, geometryN(geometry, 1) line from t
  442. UNION ALL
  443. SELECT createuuid(),idx + 1 idx, sid, did, cnt,geometry, geometryN(geometry , idx +1 ) line FROM cte
  444. WHERE idx < cnt
  445. )
  446. insert into @outtable@
  447. SELECT null,PIEUUID,sid, did,'L05' rulecode, line geometry FROM cte order by sid, did;
  448. 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@'));"
  449. UI:
  450. inparam:
  451. - type: vector
  452. ARG: intable_s
  453. name: 输入线图层
  454. description:
  455. defaultValue:
  456. help:
  457. outparam:
  458. - type: databasetable
  459. ARG: outtable
  460. name: 输出结果表
  461. description:
  462. fileFilter: "gsf;;shp;;spa"
  463. defaultValue: newTable
  464. help: ""
  465. parentLayerParameterName: intable_s
  466. image: "L05.png"
  467. icon: "processingAlgorithm.png"
  468. description: "说明:同一图层中的线互相之间不能相交或叠置。任何与要素叠置的线或任何相交点都是错误的。"
  469. L06:
  470. note: "线不能自重叠"
  471. lastupdated: [ 2024-11-22, ]
  472. roadmap: "临时表创建为view无法建立索引,暂时去除索引判断"
  473. front: [ ]
  474. ARG:
  475. - intable_s:
  476. meaning: 输入表的名字
  477. type: B
  478. - tolerance:
  479. meaning: 容差
  480. type: f
  481. RTN:
  482. - outtable:
  483. meaning: 输出表的名字
  484. type: B
  485. DRTN: { meaning: 正确执行返回1, type: int }
  486. RARG: [ '@intable_s@=输入表的名字','@tolerance@=容差','@outtable@=输出表的名字' ]
  487. RUNTYPE: repl
  488. ALG: "drop table if exists temp_line;
  489. create table temp_line(UUID,id integer, idx integer, cnt integer, geometry LINESTRING);
  490. insert into temp_line(UUID,id, idx,cnt, geometry)
  491. WITH t as
  492. (select createuuid(), ogc_fid id, numGeometries(DissolveSegments(geometry)) cnt, DissolveSegments(geometry) geometry
  493. from @intable_s@
  494. where numpoints(geometry) > 2 )
  495. ,cte(UUID,idx, id,cnt,geometry,line) AS
  496. (
  497. SELECT createuuid(),1 idx, id ,cnt, geometry, geometryN(geometry, 1) line from t
  498. UNION ALL
  499. SELECT createuuid(),idx + 1 idx, id, cnt,geometry, geometryN(geometry , idx +1 ) line FROM cte
  500. WHERE idx < cnt
  501. )
  502. SELECT UUID,id, idx, cnt,transform(line,3857) geometry FROM cte order by id, idx;
  503. 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@'));
  504. select CreateSpatialIndex('temp_line', 'geometry');
  505. drop table if exists @outtable@;
  506. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,idx,rulecode,geometry MULTILINESTRING);
  507. with t1 as(
  508. select createuuid() UUID,c.id sid, (c.idx || '_' || d.idx) idx, collect(c.geometry, d.geometry) geom,
  509. abs(degrees(azimuth(startpoint(c.geometry), endpoint(c.geometry)) - azimuth(startpoint(d.geometry), endpoint(d.geometry)))) angle,
  510. abs( ST_MaxDistance(c.geometry, d.geometry) - st_length(c.geometry) - st_length(d.geometry)) maxdist,
  511. ExtractMultiLinestring(intersection(c.geometry, d.geometry)) inter
  512. from idx_temp_line_geometry a, idx_temp_line_geometry b, temp_line c, temp_line d
  513. where (a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax)
  514. and a.rowid = c.rowid and b.rowid = d.rowid
  515. and c.id = d.id and c.idx < d.idx
  516. and (( abs(c.idx - d.idx) > 1 and abs(c.idx - d.idx) <> c.cnt - 1 and st_distance(c.geometry, d.geometry) < @tolerance@ )
  517. or (inter is not null) )
  518. order by c.id, c.idx, d.idx
  519. ),
  520. t2 as(
  521. select UUID, sid, idx, 'L06' rulecode, casttomulti(transform(geom,CastToInteger( (select srid from geometry_columns where f_table_name = '@intable_s@') ))) geometry from t1
  522. where (angle < 2.0 or abs( angle - 180.0 ) < 2.0 ) and maxdist > @tolerance@)
  523. insert into @outtable@
  524. select null,UUID,sid,idx,rulecode,geometry from t2;
  525. 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@'));"
  526. UI:
  527. inparam:
  528. - type: vector
  529. ARG: intable_s
  530. name: 输入线图层
  531. description:
  532. defaultValue:
  533. help:
  534. - type: double
  535. ARG: tolerance
  536. name: 容差
  537. description:
  538. defaultValue:
  539. help:
  540. outparam:
  541. - type: databasetable
  542. ARG: outtable
  543. name: 输出结果表
  544. description:
  545. fileFilter: "gsf;;shp;;spa"
  546. defaultValue: newTable
  547. help: ""
  548. parentLayerParameterName: intable_s
  549. image: "L06.png"
  550. icon: "processingAlgorithm.png"
  551. description: "说明: 一个图层中的线要素不能自相交或自叠置。任何存在要素自叠置的线都是错误的。"
  552. L07:
  553. note: "线不能自相交"
  554. lastupdated: [ 2024-11-22, ]
  555. roadmap: ""
  556. front: [ ]
  557. ARG:
  558. - intable_s:
  559. meaning: 输入表的名字
  560. type: B
  561. RTN:
  562. - outtable:
  563. meaning: 输出表的名字
  564. type: B
  565. DRTN: { meaning: 正确执行返回1, type: int }
  566. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ]
  567. RUNTYPE: repl
  568. ALG: "drop table if exists @outtable@;
  569. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,idx,rulecode,geometry POINT);
  570. with t as(
  571. select createuuid(), ogc_fid as id,
  572. numGeometries(ST_SelfIntersections(geometry)) cnt,
  573. ST_SelfIntersections(geometry) geometry
  574. from @intable_s@
  575. where ST_SelfIntersections(geometry) is not null),
  576. cte(UUID,idx, id,cnt,geometry,line) AS
  577. (
  578. SELECT createuuid(), 1 idx, id, cnt, geometry, geometryN(geometry, 1) line from t
  579. UNION ALL
  580. SELECT createuuid(),idx + 1 idx, id, cnt,geometry, geometryN(geometry , idx +1 ) line FROM cte
  581. WHERE idx < cnt
  582. )
  583. insert into @outtable@
  584. SELECT null,UUID,id,idx,'L07' rulecode, line geometry FROM cte order by id, idx;
  585. 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@'));"
  586. UI:
  587. inparam:
  588. - type: vector
  589. ARG: intable_s
  590. name: 输入线图层
  591. description:
  592. defaultValue:
  593. help:
  594. outparam:
  595. - type: databasetable
  596. ARG: outtable
  597. name: 输出结果表
  598. description:
  599. fileFilter: "gsf;;shp;;spa"
  600. defaultValue: newTable
  601. help: ""
  602. parentLayerParameterName: intable_s
  603. image: "L07.png"
  604. icon: "processingAlgorithm.png"
  605. description: "说明: 一个图层中的线要素不能自相交。任何存在要素自叠置的线或要素自相交的点都是错误的。"
  606. L08:
  607. note: "线不能相交或者内部相连"
  608. lastupdated: [ 2024-11-22, ]
  609. roadmap: ""
  610. front: [ ]
  611. ARG:
  612. - intable_s:
  613. meaning: 输入表的名字
  614. type: B
  615. RTN:
  616. - outtableP:
  617. meaning: 输出点错误表的名字
  618. type: B
  619. - outtableL:
  620. meaning: 输出线错误表的名字
  621. type: B
  622. DRTN: { meaning: 正确执行返回1, type: int }
  623. # RARG: [ '@intable_s@=输入表的名字','@outtableP@=输出点错误表的名字','@outtableL@=输出线错误表的名字' ]
  624. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ]
  625. RUNTYPE: repl
  626. ALG: "drop view if exists L08view;
  627. create view L08view as
  628. select c.ogc_fid sid, d.ogc_fid did,
  629. numGeometries( intersection( c.geometry, d.geometry )) cnt,
  630. intersection( c.geometry, d.geometry ) geometry
  631. from idx_@intable_s@_geometry a, idx_@intable_s@_geometry b, @intable_s@ as c, @intable_s@ as d
  632. where a.rowid < b.rowid
  633. and (a.xmin < b.xmax and a.xmax > b.xmin and a.ymin < b.ymax and a.ymax > b.ymin)
  634. and a.rowid = c.rowid and b.rowid = d.rowid
  635. and intersects(c.geometry, d.geometry )
  636. and relate(c.geometry, d.geometry) not like 'FF_F0____';
  637. drop table if exists @outtable@_P;
  638. create table @outtable@_P(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POINT);
  639. with t as (select sid,did,cnt, geometry geometry
  640. from L08view
  641. where geometrytype(geometry) like '%POINT')
  642. , cte as (
  643. SELECT 1 idx, sid, did, cnt, geometry, geometryN(geometry, 1) line from t
  644. UNION ALL
  645. SELECT idx + 1 idx, sid, did,cnt,geometry, geometryN(geometry , idx + 1 ) line FROM cte
  646. WHERE idx < cnt
  647. )
  648. insert into @outtable@_P
  649. select null,createuuid(),sid,did,'L08' rulecode,line geometry from cte
  650. order by sid, did, idx;
  651. 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@'));
  652. drop table if exists @outtable@;
  653. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTILINESTRING);
  654. insert into @outtable@
  655. select null,createuuid(), sid,did, 'L08' rulecode, ExtractMultiLinestring(geometry) geometry
  656. from L08view
  657. where geometrytype(geometry) like '%LINESTRING'
  658. order by sid, did;
  659. 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@'));"
  660. UI:
  661. inparam:
  662. - type: vector
  663. ARG: intable_s
  664. name: 输入线图层
  665. description:
  666. defaultValue:
  667. help:
  668. outparam:
  669. - type: databasetable
  670. ARG: outtable
  671. name: 输出结果表
  672. description:
  673. fileFilter: "gsf;;shp;;spa"
  674. defaultValue: newTable
  675. help: ""
  676. parentLayerParameterName: intable_s
  677. image: "L08.png"
  678. icon: "processingAlgorithm.png"
  679. description: "说明: 一个图层中的线必须在其端点处与同一图层中的其他线相接触。任何与要素叠置的线或任何相交点都是错误的。"
  680. L09:
  681. note: "线线相交交点处必须存在节点"
  682. lastupdated: [ 2024-11-22, ]
  683. roadmap: "存在问题,临时表创建为view无法建立索引,最后的判断无法进行"
  684. front: [ ]
  685. ARG:
  686. - intable_s:
  687. meaning: 输入表的名字
  688. type: B
  689. RTN:
  690. - outtable:
  691. meaning: 输出表的名字
  692. type: B
  693. DRTN: { meaning: 正确执行返回1, type: int }
  694. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ]
  695. RUNTYPE: repl
  696. ALG: "drop table if exists temp_points;
  697. create table temp_points(id integer, idx integer,geometry POINT);
  698. insert into temp_points(id, idx, geometry)
  699. WITH t as (
  700. select ogc_fid id,
  701. numGeometries(DissolvePoints(geometry)) cnt,
  702. DissolvePoints(geometry) geometry
  703. from @intable_s@
  704. ),
  705. cte(idx, id, cnt, geometry, point) AS (
  706. SELECT 1 idx,
  707. id,
  708. cnt,
  709. geometry,
  710. geometryN(geometry, 1) point
  711. from t
  712. UNION ALL
  713. SELECT idx + 1 idx,
  714. id,
  715. cnt,
  716. geometry,
  717. geometryN(geometry, idx + 1) point
  718. FROM cte
  719. WHERE idx < cnt
  720. )
  721. SELECT id,
  722. idx,
  723. point geometry
  724. FROM cte
  725. order by id,
  726. idx;
  727. 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@'));
  728. select CreateSpatialIndex('temp_points', 'geometry');
  729. drop table if exists temp_points_other;
  730. create table temp_points_other(id integer, idx integer,geometry POINT);
  731. insert into temp_points_other(id, idx, geometry)
  732. WITH t as (
  733. select c.ogc_fid id,
  734. numgeometries(ExtractMultiPoint(intersection(c.geometry, d.geometry))) cnt,
  735. ExtractMultiPoint(intersection(c.geometry, d.geometry)) geometry
  736. from idx_@intable_s@_geometry a,
  737. idx_@intable_s@_geometry b,
  738. @intable_s@ as c,
  739. @intable_s@ as d
  740. where a.rowid < b.rowid
  741. and (
  742. a.xmin <= b.xmax
  743. and a.xmax >= b.xmin
  744. and a.ymin <= b.ymax
  745. and a.ymax >= b.ymin
  746. )
  747. and a.rowid = c.rowid
  748. and b.rowid = d.rowid
  749. and crosses(c.geometry, d.geometry) = 1
  750. and ExtractMultiPoint(intersection(c.geometry, d.geometry)) is not null
  751. ),
  752. cte(idx, id, cnt, geometry, point) AS (
  753. SELECT 1 idx,
  754. id,
  755. cnt,
  756. geometry,
  757. geometryN(geometry, 1) point
  758. from t
  759. UNION ALL
  760. SELECT idx + 1 idx,
  761. id,
  762. cnt,
  763. geometry,
  764. geometryN(geometry, idx + 1) point
  765. FROM cte
  766. WHERE idx < cnt
  767. )
  768. SELECT id,
  769. idx,
  770. point geometry
  771. FROM cte
  772. order by id,
  773. idx;
  774. 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@'));
  775. select CreateSpatialIndex('temp_points_other', 'geometry');
  776. drop table if exists @outtable@;
  777. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,idx,rulecode,geometry POINT);
  778. insert into @outtable@
  779. select null,createuuid(),id,
  780. idx,
  781. 'L09' rulecode,
  782. geometry
  783. from temp_points_other
  784. where rowid not in (
  785. select a.rowid
  786. from idx_temp_points_other_geometry a,
  787. idx_temp_points_geometry b
  788. where (
  789. a.xmin < b.xmax
  790. and a.xmax > b.xmin
  791. and a.ymin < b.ymax
  792. and a.ymax > b.ymin
  793. ));
  794. 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@'));"
  795. UI:
  796. inparam:
  797. - type: vector
  798. ARG: intable_s
  799. name: 输入线图层
  800. description:
  801. defaultValue:
  802. help:
  803. outparam:
  804. - type: databasetable
  805. ARG: outtable
  806. name: 输出结果表
  807. description:
  808. fileFilter: "gsf;;shp;;spa"
  809. defaultValue: newTable
  810. help: ""
  811. parentLayerParameterName: intable_s
  812. image: "L09.png"
  813. icon: "processingAlgorithm.png"
  814. description: "说明:一个图层中的线如果存在相交的情况,那么在相交处必须存在节点。任何不存在节点的相交线都是错误的。"
  815. L10:
  816. note: "线节点距离必须大于聚合阈值"
  817. lastupdated: [ 2024-11-22, ]
  818. roadmap: ""
  819. front: [ ]
  820. ARG:
  821. - intable_s:
  822. meaning: 输入表的名字
  823. type: B
  824. - tolerance:
  825. meaning: 容差
  826. type: f
  827. RTN:
  828. - outtable:
  829. meaning: 输出表的名字
  830. type: B
  831. DRTN: { meaning: 正确执行返回1, type: int }
  832. RARG: [ '@intable_s@=输入表的名字','@tolerance@=容差','@outtable@=输出表的名字' ]
  833. RUNTYPE: repl
  834. ALG: "drop table if exists @outtable@;
  835. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,idx,length,rulecode,geometry LINESTRING);
  836. WITH t as (
  837. select createuuid(), ogc_fid id,
  838. numGeometries(DissolveSegments(geometry)) cnt,
  839. DissolveSegments(geometry) geometry
  840. from @intable_s@
  841. ),
  842. cte(UUID,idx, id, cnt, geometry, line) AS (
  843. SELECT createuuid(),
  844. 1 idx,
  845. id,
  846. cnt,
  847. geometry,
  848. geometryN(geometry, 1) line
  849. from t
  850. UNION ALL
  851. SELECT createuuid(),
  852. idx + 1 idx,
  853. id,
  854. cnt,
  855. geometry,
  856. geometryN(geometry, idx + 1) line
  857. FROM cte
  858. WHERE idx < cnt
  859. )
  860. insert into @outtable@
  861. SELECT null,UUID, id,
  862. idx,
  863. st_length(transform(line,3857)) length,
  864. 'L10' rulecode,
  865. line geometry
  866. FROM cte
  867. where st_length(transform(line,3857)) < @tolerance@
  868. order by id,idx;
  869. 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@'));"
  870. UI:
  871. inparam:
  872. - type: vector
  873. ARG: intable_s
  874. name: 输入线图层
  875. description:
  876. defaultValue:
  877. help:
  878. - type: double
  879. ARG: tolerance
  880. name: 容差
  881. description:
  882. defaultValue:
  883. help:
  884. outparam:
  885. - type: databasetable
  886. ARG: outtable
  887. name: 输出结果表
  888. description:
  889. fileFilter: "gsf;;shp;;spa"
  890. defaultValue: newTable
  891. help: ""
  892. parentLayerParameterName: intable_s
  893. image: "L10.png"
  894. icon: "processingAlgorithm.png"
  895. description: "说明: 线节点距离必须大于拓扑容差值,这样两个节点自动连接在一起,避免有缝隙出现。任何两个小于拓扑容差距离的线节点都是错误的。"
  896. A00:
  897. note: "面有效性检查"
  898. lastupdated: [ 2024-11-22, ]
  899. roadmap: ""
  900. front: [ ]
  901. ARG:
  902. - intable_s:
  903. meaning: 输入表的名字
  904. type: B
  905. RTN:
  906. - outtable:
  907. meaning: 输出表的名字
  908. type: B
  909. DRTN: { meaning: 正确执行返回1, type: int }
  910. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ]
  911. RUNTYPE: repl
  912. ALG: "drop table if exists @outtable@;
  913. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry MULTIPOLYGON);
  914. insert into @outtable@
  915. select null,createuuid(),ogc_fid sid,'A00' rulecode, geometry geometry
  916. from @intable_s@ where isvalid(geometry) <> 1;
  917. 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@'));"
  918. UI:
  919. inparam:
  920. - type: vector
  921. ARG: intable_s
  922. name: 输入面图层
  923. description:
  924. defaultValue:
  925. help:
  926. outparam:
  927. - type: databasetable
  928. ARG: outtable
  929. name: 输出结果表
  930. description:
  931. fileFilter: "gsf;;shp;;spa"
  932. defaultValue: newTable
  933. help: ""
  934. parentLayerParameterName: intable_s
  935. image: "A00.png"
  936. icon: "processingAlgorithm.png"
  937. description: "说明: 面要素不能无效"
  938. A01:
  939. note: "面不能重叠"
  940. lastupdated: [ 2024-11-22, ]
  941. roadmap: ""
  942. front: [ ]
  943. ARG:
  944. - intable_s:
  945. meaning: 输入表的名字
  946. type: B
  947. RTN:
  948. - outtable:
  949. meaning: 输出表的名字
  950. type: B
  951. DRTN: { meaning: 正确执行返回1, type: int }
  952. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ]
  953. RUNTYPE: repl
  954. ALG: "drop table if exists @outtable@;
  955. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POLYGON);
  956. with t as(
  957. select createuuid(),c.ogc_fid sid, d.ogc_fid did,
  958. numGeometries(intersection(c.geometry, d.geometry)) cnt,
  959. intersection(c.geometry, d.geometry) geometry
  960. from idx_@intable_s@_geometry a,
  961. idx_@intable_s@_geometry b,
  962. @intable_s@ as c,
  963. @intable_s@ as d
  964. where a.rowid < b.rowid
  965. and (
  966. a.xmin < b.xmax
  967. and a.xmax > b.xmin
  968. and a.ymin < b.ymax
  969. and a.ymax > b.ymin
  970. )
  971. and a.rowid = c.rowid
  972. and b.rowid = d.rowid
  973. and intersects(c.geometry, d.geometry) = 1
  974. and ST_Dimension(intersection(c.geometry, d.geometry)) > 1
  975. ),
  976. cte(PIEUUID,idx, sid,did, cnt, geometry, subgeom) AS (
  977. SELECT createuuid(),
  978. 1 idx,
  979. sid,
  980. did,
  981. cnt,
  982. geometry,
  983. geometryN(geometry, 1) subgeom
  984. from t
  985. UNION ALL
  986. SELECT PIEUUID,
  987. idx + 1 idx,
  988. sid,
  989. did,
  990. cnt,
  991. geometry,
  992. geometryN(geometry, idx + 1) subgeom
  993. FROM cte
  994. WHERE idx < cnt
  995. )
  996. insert into @outtable@
  997. SELECT null,PIEUUID,sid,
  998. 'A01' rulecode,
  999. subgeom geometry
  1000. FROM cte
  1001. where geometrytype(subgeom) = 'POLYGON'
  1002. order by sid,
  1003. did;
  1004. 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@'));"
  1005. UI:
  1006. inparam:
  1007. - type: vector
  1008. ARG: intable_s
  1009. name: 输入面图层
  1010. description:
  1011. defaultValue:
  1012. help:
  1013. outparam:
  1014. - type: databasetable
  1015. ARG: outtable
  1016. name: 输出结果表
  1017. description:
  1018. fileFilter: "gsf;;shp;;spa"
  1019. defaultValue: newTable
  1020. help: ""
  1021. parentLayerParameterName: intable_s
  1022. image: "A01.png"
  1023. icon: "processingAlgorithm.png"
  1024. description: "说明: 一个区域不能与同一图层的另一个区域叠置。任何存在要素重叠的区域都是错误的。"
  1025. A02:
  1026. note: "面自身不能有内洞"
  1027. lastupdated: [ 2024-11-22, ]
  1028. roadmap: ""
  1029. front: [ ]
  1030. ARG:
  1031. - intable_s:
  1032. meaning: 输入表的名字
  1033. type: B
  1034. RTN:
  1035. - outtable:
  1036. meaning: 输出表的名字
  1037. type: B
  1038. DRTN: { meaning: 正确执行返回1, type: int }
  1039. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ]
  1040. RUNTYPE: repl
  1041. ALG: "drop table if exists @outtable@;
  1042. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,ringNum,rulecode,geometry MULTIPOLYGON);
  1043. insert into @outtable@
  1044. select null,createuuid(),ogc_fid sid, NumInteriorRing(geometry) ringNum, 'A02' rulecode, geometry geometry
  1045. from @intable_s@
  1046. where NumInteriorRing(geometry) > 0
  1047. order by sid;
  1048. 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@'));"
  1049. UI:
  1050. inparam:
  1051. - type: vector
  1052. ARG: intable_s
  1053. name: 输入面图层
  1054. description:
  1055. defaultValue:
  1056. help:
  1057. outparam:
  1058. - type: databasetable
  1059. ARG: outtable
  1060. name: 输出结果表
  1061. description:
  1062. fileFilter: "gsf;;shp;;spa"
  1063. defaultValue: newTable
  1064. help: ""
  1065. parentLayerParameterName: intable_s
  1066. image: "A02.png"
  1067. icon: "processingAlgorithm.png"
  1068. description: "说明:一个区域内部不能出现空的情况。任何存在空的区域都是错误的。"
  1069. A03:
  1070. note: "面不能有空隙"
  1071. lastupdated: [ 2024-11-22, ]
  1072. roadmap: ""
  1073. front: [ ]
  1074. ARG:
  1075. - intable_s:
  1076. meaning: 输入表的名字
  1077. type: B
  1078. RTN:
  1079. - outtable:
  1080. meaning: 输出表的名字
  1081. type: B
  1082. DRTN: { meaning: 正确执行返回1, type: int }
  1083. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ]
  1084. RUNTYPE: repl
  1085. ALG: "drop table if exists @outtable@;
  1086. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,idx,rulecode,geometry MULTILINESTRING);
  1087. with t as(
  1088. select 0 sid,
  1089. 0 did,
  1090. numgeometries(linesfromrings(gunion(geometry))) cnt,
  1091. linesfromrings(gunion(geometry)) geometry
  1092. from @intable_s@
  1093. ),
  1094. cte(idx, sid, did, cnt, geometry, subgeom) AS (
  1095. SELECT 1 idx,
  1096. sid,
  1097. did,
  1098. cnt,
  1099. geometry,
  1100. geometryN(geometry, 1) subgeom
  1101. from t
  1102. UNION ALL
  1103. SELECT idx + 1 idx,
  1104. sid,
  1105. did,
  1106. cnt,
  1107. geometry,
  1108. geometryN(geometry, idx + 1) subgeom
  1109. FROM cte
  1110. WHERE idx < cnt
  1111. )
  1112. insert into @outtable@
  1113. SELECT null,createuuid(),
  1114. sid,
  1115. idx,
  1116. 'A03' rulecode,
  1117. casttomulti(subgeom) geometry
  1118. FROM cte;
  1119. 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@'));"
  1120. UI:
  1121. inparam:
  1122. - type: vector
  1123. ARG: intable_s
  1124. name: 输入面图层
  1125. description:
  1126. defaultValue:
  1127. help:
  1128. outparam:
  1129. - type: databasetable
  1130. ARG: outtable
  1131. name: 输出结果表
  1132. description:
  1133. fileFilter: "gsf;;shp;;spa"
  1134. defaultValue: newTable
  1135. help: ""
  1136. parentLayerParameterName: intable_s
  1137. image: "A03.png"
  1138. icon: "processingAlgorithm.png"
  1139. description: "说明: 同一图层中的区域之间不能存在空隙。存在任何空隙的边界都是错误的。"
  1140. A04:
  1141. note: "面不能自相交"
  1142. lastupdated: [ 2024-11-22, ]
  1143. roadmap: ""
  1144. front: [ ]
  1145. ARG:
  1146. - intable_s:
  1147. meaning: 输入表的名字
  1148. type: B
  1149. RTN:
  1150. - outtable:
  1151. meaning: 输出表的名字
  1152. type: B
  1153. DRTN: { meaning: 正确执行返回1, type: int }
  1154. RARG: [ '@intable_s@=输入表的名字','@outtable@=输出表的名字' ]
  1155. RUNTYPE: repl
  1156. ALG: "drop table if exists @outtable@;
  1157. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry MULTIPOLYGON);
  1158. insert into @outtable@
  1159. select null,createuuid(),
  1160. ogc_fid sid,
  1161. 'A04' rulecode,
  1162. geometry geometry
  1163. from @intable_s@
  1164. where ST_NumPoints(linesfromrings(geometry)) > 3
  1165. and ST_SelfIntersections(linesfromrings(geometry)) is not null;
  1166. 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@'));
  1167. "
  1168. UI:
  1169. inparam:
  1170. - type: vector
  1171. ARG: intable_s
  1172. name: 输入面图层
  1173. description:
  1174. defaultValue:
  1175. help:
  1176. outparam:
  1177. - type: databasetable
  1178. ARG: outtable
  1179. name: 输出结果表
  1180. description:
  1181. fileFilter: "gsf;;shp;;spa"
  1182. defaultValue: newTable
  1183. help: ""
  1184. parentLayerParameterName: intable_s
  1185. image: "A04.png"
  1186. icon: "processingAlgorithm.png"
  1187. description: "说明: 一个图层中的面要素不能自相交。任何存在要素自叠置的面或要素自相交的点都是错误的。"
  1188. A05:
  1189. note: "面节点距离必须大于聚合阈值"
  1190. lastupdated: [ 2024-11-22, ]
  1191. roadmap: ""
  1192. front: [ ]
  1193. ARG:
  1194. - intable_s:
  1195. meaning: 输入表的名字
  1196. type: B
  1197. - tolerance:
  1198. meaning: 容差
  1199. type: f
  1200. RTN:
  1201. - outtable:
  1202. meaning: 输出表的名字
  1203. type: B
  1204. DRTN: { meaning: 正确执行返回1, type: int }
  1205. RARG: [ '@intable_s@=输入表的名字','@tolerance@=容差','@outtable@=输出表的名字' ]
  1206. RUNTYPE: repl
  1207. ALG: "drop table if exists @outtable@;
  1208. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,idx,length,rulecode,geometry LINESTRING);
  1209. WITH t as (
  1210. select createuuid(),ogc_fid id,
  1211. numGeometries(DissolveSegments(geometry)) cnt,
  1212. DissolveSegments(geometry) geometry
  1213. from @intable_s@
  1214. ),
  1215. cte(UUID,idx, id, cnt, geometry, line) AS (
  1216. SELECT createuuid(),
  1217. 1 idx,
  1218. id,
  1219. cnt,
  1220. geometry,
  1221. geometryN(geometry, 1) line
  1222. from t
  1223. UNION ALL
  1224. SELECT createuuid(),
  1225. idx + 1 idx,
  1226. id,
  1227. cnt,
  1228. geometry,
  1229. geometryN(geometry, idx + 1) line
  1230. FROM cte
  1231. WHERE idx < cnt
  1232. )
  1233. insert into @outtable@
  1234. SELECT null,UUID,
  1235. id,
  1236. idx,
  1237. st_length(transform(line,3857)) length,
  1238. 'A05' rulecode,
  1239. line geometry
  1240. FROM cte
  1241. where st_length(transform(line,3857)) < @tolerance@
  1242. order by id,
  1243. idx;
  1244. 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@'));"
  1245. UI:
  1246. inparam:
  1247. - type: vector
  1248. ARG: intable_s
  1249. name: 输入面图层
  1250. description:
  1251. defaultValue:
  1252. help:
  1253. - type: double
  1254. ARG: tolerance
  1255. name: 容差
  1256. description:
  1257. defaultValue:
  1258. help:
  1259. outparam:
  1260. - type: databasetable
  1261. ARG: outtable
  1262. name: 输出结果表
  1263. description:
  1264. fileFilter: "gsf;;shp;;spa"
  1265. defaultValue: newTable
  1266. help: ""
  1267. parentLayerParameterName: intable_s
  1268. image: "A05.png"
  1269. icon: "processingAlgorithm.png"
  1270. description: "说明: 面节点距离必须大于容差值,这样两个节点自动连接在一起,避免多边形有缝隙出现。任何两个小于容差距离的节点都是错误的。"
  1271. PP01:
  1272. note: "点必须被其他要素类覆盖(点-点)"
  1273. lastupdated: [ 2024-11-22, ]
  1274. roadmap: ""
  1275. front: [ ]
  1276. ARG:
  1277. - intable_s:
  1278. meaning: 输入表的名字
  1279. type: B
  1280. - intable_t:
  1281. meaning: 目标表的名字
  1282. type: B
  1283. RTN:
  1284. - outtable:
  1285. meaning: 输出表的名字
  1286. type: B
  1287. DRTN: { meaning: 正确执行返回1, type: int }
  1288. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  1289. RUNTYPE: repl
  1290. ALG: "drop table if exists @outtable@;
  1291. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POINT);
  1292. insert into @outtable@
  1293. select null,createuuid(),ogc_fid sid,'PP01' rulecode, geometry from @intable_s@ where rowid not in
  1294. (select a.rowid
  1295. from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d
  1296. where (a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax)
  1297. and a.rowid = c.rowid and b.rowid = d.rowid
  1298. and intersects(c.geometry, d.geometry)
  1299. and geometrytype(c.geometry) = 'POINT'
  1300. and geometrytype(d.geometry) = 'POINT');
  1301. 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@'));"
  1302. UI:
  1303. inparam:
  1304. - type: vector
  1305. ARG: intable_s
  1306. name: 输入点图层
  1307. description:
  1308. defaultValue:
  1309. help:
  1310. - type: vector
  1311. ARG: intable_t
  1312. name: 目标点图层
  1313. description:
  1314. defaultValue:
  1315. help:
  1316. outparam:
  1317. - type: databasetable
  1318. ARG: outtable
  1319. name: 输出结果表
  1320. description:
  1321. fileFilter: "gsf;;shp;;spa"
  1322. defaultValue: newTable
  1323. help: ""
  1324. parentLayerParameterName: intable_s
  1325. image: "PP01.png"
  1326. icon: "processingAlgorithm.png"
  1327. description: "说明: 一个图层中的点要素必须被另一个图层中的点要素重合。第一个图层中未被第二个图层中的点覆盖的任何点都是错误的。"
  1328. PP02:
  1329. note: "点不与其他要素点重合(点-点)"
  1330. lastupdated: [ 2024-11-22, ]
  1331. roadmap: ""
  1332. front: [ ]
  1333. ARG:
  1334. - intable_s:
  1335. meaning: 输入表的名字
  1336. type: B
  1337. - intable_t:
  1338. meaning: 目标表的名字
  1339. type: B
  1340. RTN:
  1341. - outtable:
  1342. meaning: 输出表的名字
  1343. type: B
  1344. DRTN: { meaning: 正确执行返回1, type: int }
  1345. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  1346. RUNTYPE: repl
  1347. ALG: "drop table if exists @outtable@;
  1348. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,count,rulecode,geometry POINT);
  1349. with t as
  1350. (
  1351. select createuuid() uuid,c.ogc_fid sid, count(1) count, 'PP02' rulecode, c.geometry geometry
  1352. from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b,
  1353. @intable_s@ c, @intable_t@ d
  1354. where (a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax)
  1355. and a.rowid = c.rowid and b.rowid = d.rowid
  1356. and intersects(c.geometry, d.geometry)
  1357. and geometrytype(c.geometry) = 'POINT'
  1358. and geometrytype(d.geometry) = 'POINT'
  1359. group by c.ogc_fid)
  1360. insert into @outtable@
  1361. select null,uuid,sid,count,rulecode,geometry from t;
  1362. 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@'));"
  1363. UI:
  1364. inparam:
  1365. - type: vector
  1366. ARG: intable_s
  1367. name: 输入点图层
  1368. description:
  1369. defaultValue:
  1370. help:
  1371. - type: vector
  1372. ARG: intable_t
  1373. name: 目标点图层
  1374. description:
  1375. defaultValue:
  1376. help:
  1377. outparam:
  1378. - type: databasetable
  1379. ARG: outtable
  1380. name: 输出结果表
  1381. description:
  1382. fileFilter: "gsf;;shp;;spa"
  1383. defaultValue: newTable
  1384. help: ""
  1385. parentLayerParameterName: intable_s
  1386. image: "PP02.png"
  1387. icon: "processingAlgorithm.png"
  1388. description: "说明: 一个图层中的点要素不与另一个图层中的点要素重合。第一个图层中被第二个图层中的点覆盖的任何点都是错误的。"
  1389. PL01:
  1390. note: "点必须被其他要素类的端点覆盖(点-线)"
  1391. lastupdated: [ 2024-11-22, ]
  1392. roadmap: ""
  1393. front: [ ]
  1394. ARG:
  1395. - intable_s:
  1396. meaning: 输入表的名字
  1397. type: B
  1398. - intable_t:
  1399. meaning: 目标表的名字
  1400. type: B
  1401. RTN:
  1402. - outtable:
  1403. meaning: 输出表的名字
  1404. type: B
  1405. DRTN: { meaning: 正确执行返回1, type: int }
  1406. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  1407. RUNTYPE: repl
  1408. ALG: "drop table if exists @outtable@;
  1409. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POINT);
  1410. insert into @outtable@
  1411. select null,createuuid(),
  1412. ogc_fid sid,
  1413. 'PL01' rulecode,
  1414. geometry
  1415. from @intable_s@
  1416. where rowid not in(
  1417. select a.rowid
  1418. from idx_@intable_s@_geometry a,
  1419. idx_@intable_t@_geometry b,
  1420. @intable_s@ c,
  1421. @intable_t@ d
  1422. where a.xmax >= b.xmin
  1423. and a.xmin <= b.xmax
  1424. and a.ymax >= b.ymin
  1425. and a.ymin <= b.ymax
  1426. and a.rowid = c.rowid
  1427. and b.rowid = d.rowid
  1428. and touches(c.geometry, d.geometry)
  1429. );
  1430. 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@'));"
  1431. UI:
  1432. inparam:
  1433. - type: vector
  1434. ARG: intable_s
  1435. name: 输入点图层
  1436. description:
  1437. defaultValue:
  1438. help:
  1439. - type: vector
  1440. ARG: intable_t
  1441. name: 目标线图层
  1442. description:
  1443. defaultValue:
  1444. help:
  1445. outparam:
  1446. - type: databasetable
  1447. ARG: outtable
  1448. name: 输出结果表
  1449. description:
  1450. fileFilter: "gsf;;shp;;spa"
  1451. defaultValue: newTable
  1452. help: ""
  1453. parentLayerParameterName: intable_s
  1454. image: "PL01.png"
  1455. icon: "processingAlgorithm.png"
  1456. description: "说明: 一个图层中的点要素必须被另一个图层的线要素的端点覆盖。如果点图层中的要素未落在线要素端点上,则是错误的。"
  1457. PL02:
  1458. note: "点必须被线覆盖(点-线)"
  1459. lastupdated: [ 2024-11-22, ]
  1460. roadmap: ""
  1461. front: [ ]
  1462. ARG:
  1463. - intable_s:
  1464. meaning: 输入表的名字
  1465. type: B
  1466. - intable_t:
  1467. meaning: 目标表的名字
  1468. type: B
  1469. RTN:
  1470. - outtable:
  1471. meaning: 输出表的名字
  1472. type: B
  1473. DRTN: { meaning: 正确执行返回1, type: int }
  1474. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  1475. RUNTYPE: repl
  1476. ALG: "drop table if exists @outtable@;
  1477. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POINT);
  1478. insert into @outtable@
  1479. select null,createuuid(),
  1480. ogc_fid sid,
  1481. 'PL02' rulecode,
  1482. geometry
  1483. from @intable_s@
  1484. where rowid not in(
  1485. select a.rowid
  1486. from idx_@intable_s@_geometry a,
  1487. idx_@intable_t@_geometry b,
  1488. @intable_s@ c,
  1489. @intable_t@ d
  1490. where a.xmax >= b.xmin
  1491. and a.xmin <= b.xmax
  1492. and a.ymax >= b.ymin
  1493. and a.ymin <= b.ymax
  1494. and a.rowid = c.rowid
  1495. and b.rowid = d.rowid
  1496. and intersects(c.geometry, d.geometry)
  1497. and not touches(c.geometry, d.geometry)
  1498. );
  1499. 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@'));"
  1500. UI:
  1501. inparam:
  1502. - type: vector
  1503. ARG: intable_s
  1504. name: 输入点图层
  1505. description:
  1506. defaultValue:
  1507. help:
  1508. - type: vector
  1509. ARG: intable_t
  1510. name: 目标线图层
  1511. description:
  1512. defaultValue:
  1513. help:
  1514. outparam:
  1515. - type: databasetable
  1516. ARG: outtable
  1517. name: 输出结果表
  1518. description:
  1519. fileFilter: "gsf;;shp;;spa"
  1520. defaultValue: newTable
  1521. help: ""
  1522. parentLayerParameterName: intable_s
  1523. image: "PL02.png"
  1524. icon: "processingAlgorithm.png"
  1525. description: "说明: 一个图层中的点要素必须被另一个图层中的线要素覆盖。任何未被线要素覆盖的点都是错误的。"
  1526. PA01:
  1527. note: "点必须被其他要素的边界覆盖(点-面)"
  1528. lastupdated: [ 2024-11-22, ]
  1529. roadmap: ""
  1530. front: [ ]
  1531. ARG:
  1532. - intable_s:
  1533. meaning: 输入表的名字
  1534. type: B
  1535. - intable_t:
  1536. meaning: 目标表的名字
  1537. type: B
  1538. RTN:
  1539. - outtable:
  1540. meaning: 输出表的名字
  1541. type: B
  1542. DRTN: { meaning: 正确执行返回1, type: int }
  1543. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  1544. RUNTYPE: repl
  1545. ALG: "drop table if exists @outtable@;
  1546. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POINT);
  1547. insert into @outtable@
  1548. select null,createuuid(),
  1549. ogc_fid sid,
  1550. 'PA01' rulecode,
  1551. geometry
  1552. from @intable_s@
  1553. where rowid not in(
  1554. select a.rowid
  1555. from idx_@intable_s@_geometry a,
  1556. idx_@intable_t@_geometry b,
  1557. @intable_s@ c,
  1558. @intable_t@ d
  1559. where a.xmax >= b.xmin
  1560. and a.xmin <= b.xmax
  1561. and a.ymax >= b.ymin
  1562. and a.ymin <= b.ymax
  1563. and a.rowid = c.rowid
  1564. and b.rowid = d.rowid
  1565. and touches(c.geometry, d.geometry)
  1566. );
  1567. 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@'));"
  1568. UI:
  1569. inparam:
  1570. - type: vector
  1571. ARG: intable_s
  1572. name: 输入点图层
  1573. description:
  1574. defaultValue:
  1575. help:
  1576. - type: vector
  1577. ARG: intable_t
  1578. name: 目标面图层
  1579. description:
  1580. defaultValue:
  1581. help:
  1582. outparam:
  1583. - type: databasetable
  1584. ARG: outtable
  1585. name: 输出结果表
  1586. description:
  1587. fileFilter: "gsf;;shp;;spa"
  1588. defaultValue: newTable
  1589. help: ""
  1590. parentLayerParameterName: intable_s
  1591. image: "PA01.png"
  1592. icon: "processingAlgorithm.png"
  1593. description: "说明: 一个图层中的点要素必须与另一个图层中面要素的边界重合。如果点图层中的要素未落在边界上,则它是错误的。"
  1594. PA02:
  1595. note: "点必须完全位于面内部(点-面)"
  1596. lastupdated: [ 2024-11-22, ]
  1597. roadmap: ""
  1598. front: [ ]
  1599. ARG:
  1600. - intable_s:
  1601. meaning: 输入表的名字
  1602. type: B
  1603. - intable_t:
  1604. meaning: 目标表的名字
  1605. type: B
  1606. RTN:
  1607. - outtable:
  1608. meaning: 输出表的名字
  1609. type: B
  1610. DRTN: { meaning: 正确执行返回1, type: int }
  1611. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  1612. RUNTYPE: repl
  1613. ALG: "drop table if exists @outtable@;
  1614. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POINT);
  1615. insert into @outtable@
  1616. select null,createuuid(),
  1617. ogc_fid sid,
  1618. 'PA02' rulecode,
  1619. geometry
  1620. from @intable_s@
  1621. where rowid not in(
  1622. select a.rowid
  1623. from idx_@intable_s@_geometry a,
  1624. idx_@intable_t@_geometry b,
  1625. @intable_s@ c,
  1626. @intable_t@ d
  1627. where a.xmax >= b.xmin
  1628. and a.xmin <= b.xmax
  1629. and a.ymax >= b.ymin
  1630. and a.ymin <= b.ymax
  1631. and a.rowid = c.rowid
  1632. and b.rowid = d.rowid
  1633. and within(c.geometry, d.geometry)
  1634. and not touches(c.geometry, d.geometry)
  1635. );
  1636. 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@'));"
  1637. UI:
  1638. inparam:
  1639. - type: vector
  1640. ARG: intable_s
  1641. name: 输入点图层
  1642. description:
  1643. defaultValue:
  1644. help:
  1645. - type: vector
  1646. ARG: intable_t
  1647. name: 目标面图层
  1648. description:
  1649. defaultValue:
  1650. help:
  1651. outparam:
  1652. - type: databasetable
  1653. ARG: outtable
  1654. name: 输出结果表
  1655. description:
  1656. fileFilter: "gsf;;shp;;spa"
  1657. defaultValue: newTable
  1658. help: ""
  1659. parentLayerParameterName: intable_s
  1660. image: "PA02.png"
  1661. icon: "processingAlgorithm.png"
  1662. description: "说明:一个图层中的点要素必须完全位于另一个图层的面要素内。未在面要素内的任何点都是错误的。"
  1663. PA03:
  1664. note: "点不在面内部或边界(点-面)"
  1665. lastupdated: [ 2024-11-22, ]
  1666. roadmap: ""
  1667. front: [ ]
  1668. ARG:
  1669. - intable_s:
  1670. meaning: 输入表的名字
  1671. type: B
  1672. - intable_t:
  1673. meaning: 目标表的名字
  1674. type: B
  1675. RTN:
  1676. - outtable:
  1677. meaning: 输出表的名字
  1678. type: B
  1679. DRTN: { meaning: 正确执行返回1, type: int }
  1680. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  1681. RUNTYPE: repl
  1682. ALG: "drop table if exists @outtable@;
  1683. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POINT);
  1684. with t as
  1685. (
  1686. select createuuid() uuid, c.ogc_fid sid, group_concat(d.ogc_fid, '-') did,'PA03' rulecode,c.geometry geometry
  1687. from idx_@intable_s@_geometry a,
  1688. idx_@intable_t@_geometry b,
  1689. @intable_s@ c,
  1690. @intable_t@ d
  1691. where a.xmax >= b.xmin
  1692. and a.xmin <= b.xmax
  1693. and a.ymax >= b.ymin
  1694. and a.ymin <= b.ymax
  1695. and a.rowid = c.rowid
  1696. and b.rowid = d.rowid
  1697. and intersects(c.geometry, d.geometry)
  1698. group by c.ogc_fid)
  1699. insert into @outtable@
  1700. select null,uuid,sid,did,rulecode,geometry from t;
  1701. 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@'));"
  1702. UI:
  1703. inparam:
  1704. - type: vector
  1705. ARG: intable_s
  1706. name: 输入点图层
  1707. description:
  1708. defaultValue:
  1709. help:
  1710. - type: vector
  1711. ARG: intable_t
  1712. name: 目标面图层
  1713. description:
  1714. defaultValue:
  1715. help:
  1716. outparam:
  1717. - type: databasetable
  1718. ARG: outtable
  1719. name: 输出结果表
  1720. description:
  1721. fileFilter: "gsf;;shp;;spa"
  1722. defaultValue: newTable
  1723. help: ""
  1724. parentLayerParameterName: intable_s
  1725. image: "PA03.png"
  1726. icon: "processingAlgorithm.png"
  1727. description: "说明: 一个图层中的点要素不能位于另一个图层的面要素内部或边界。在面要素内部和边界的任何点都是错误的。"
  1728. LP01:
  1729. note: "线端点必须被其他要素覆盖(线-点)"
  1730. lastupdated: [ 2023-1-4, ]
  1731. roadmap: ""
  1732. front: [ ]
  1733. ARG:
  1734. - intable_s:
  1735. meaning: 输入表的名字
  1736. type: B
  1737. - intable_t:
  1738. meaning: 目标表的名字
  1739. type: B
  1740. RTN:
  1741. - outtable:
  1742. meaning: 输出表的名字
  1743. type: B
  1744. DRTN: { meaning: 正确执行返回1, type: int }
  1745. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  1746. RUNTYPE: repl
  1747. ALG: "drop table if exists @outtable@;
  1748. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry LINESTRING);
  1749. insert into @outtable@
  1750. select null,createuuid(),
  1751. ogc_fid sid,
  1752. 'LP01' rulecode,
  1753. geometry geometry
  1754. from @intable_s@
  1755. where rowid not in(
  1756. select rowid from (
  1757. select a.rowid,count(*) cnt
  1758. from idx_@intable_s@_geometry a,
  1759. idx_@intable_t@_geometry b,
  1760. @intable_s@ c,
  1761. @intable_t@ d
  1762. where a.xmax >= b.xmin
  1763. and a.xmin <= b.xmax
  1764. and a.ymax >= b.ymin
  1765. and a.ymin <= b.ymax
  1766. and a.rowid = c.rowid
  1767. and b.rowid = d.rowid
  1768. and touches(c.geometry, d.geometry)
  1769. group by a.rowid
  1770. having cnt > 1)
  1771. );
  1772. 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@'));"
  1773. UI:
  1774. inparam:
  1775. - type: vector
  1776. ARG: intable_s
  1777. name: 输入线图层
  1778. description:
  1779. defaultValue:
  1780. help:
  1781. - type: vector
  1782. ARG: intable_t
  1783. name: 目标点图层
  1784. description:
  1785. defaultValue:
  1786. help:
  1787. outparam:
  1788. - type: databasetable
  1789. ARG: outtable
  1790. name: 输出结果表
  1791. description:
  1792. fileFilter: "gsf;;shp;;spa"
  1793. defaultValue: newTable
  1794. help: ""
  1795. parentLayerParameterName: intable_s
  1796. image: "LP01.png"
  1797. icon: "processingAlgorithm.png"
  1798. description: "说明: 一个图层中线的端点必须被另一个图层中的点要素覆盖。任何未被点要素覆盖的端点都是错误的。"
  1799. LL01:
  1800. note: "线不能与其他要素线相交(线-线)"
  1801. lastupdated: [ 2023-1-4, ]
  1802. roadmap: ""
  1803. front: [ ]
  1804. ARG:
  1805. - intable_s:
  1806. meaning: 输入表的名字
  1807. type: B
  1808. - intable_t:
  1809. meaning: 目标表的名字
  1810. type: B
  1811. RTN:
  1812. - outtable:
  1813. meaning: 输出表的名字
  1814. type: B
  1815. DRTN: { meaning: 正确执行返回1, type: int }
  1816. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  1817. RUNTYPE: repl
  1818. ALG: "drop table if exists @outtable@;
  1819. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POINT);
  1820. with t as (
  1821. select c.ogc_fid id,
  1822. numGeometries(intersection(c.geometry, d.geometry)) cnt,
  1823. intersection(c.geometry, d.geometry) geometry
  1824. from idx_@intable_s@_geometry a,
  1825. idx_@intable_t@_geometry b,
  1826. @intable_s@ c,
  1827. @intable_t@ d
  1828. where a.xmax >= b.xmin
  1829. and a.xmin <= b.xmax
  1830. and a.ymax >= b.ymin
  1831. and a.ymin <= b.ymax
  1832. and a.rowid = c.rowid
  1833. and b.rowid = d.rowid
  1834. and crosses(c.geometry, d.geometry)
  1835. ),
  1836. cte(idx, id, cnt, geometry, line) AS (
  1837. SELECT 1 idx,
  1838. id,
  1839. cnt,
  1840. geometry,
  1841. geometryN(geometry, 1) line
  1842. from t
  1843. UNION ALL
  1844. SELECT idx + 1 idx,
  1845. id,
  1846. cnt,
  1847. geometry,
  1848. geometryN(geometry, idx + 1) line
  1849. FROM cte
  1850. WHERE idx < cnt
  1851. )
  1852. insert into @outtable@
  1853. SELECT null,createuuid(),
  1854. id sid,
  1855. idx did,
  1856. 'LL01' rulecode,
  1857. line geometry
  1858. FROM cte
  1859. order by id,
  1860. idx;
  1861. 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@'));"
  1862. UI:
  1863. inparam:
  1864. - type: vector
  1865. ARG: intable_s
  1866. name: 输入线图层
  1867. description:
  1868. defaultValue:
  1869. help:
  1870. - type: vector
  1871. ARG: intable_t
  1872. name: 目标线图层
  1873. description:
  1874. defaultValue:
  1875. help:
  1876. outparam:
  1877. - type: databasetable
  1878. ARG: outtable
  1879. name: 输出结果表
  1880. description:
  1881. fileFilter: "gsf;;shp;;spa"
  1882. defaultValue: newTable
  1883. help: ""
  1884. parentLayerParameterName: intable_s
  1885. image: "LL01.png"
  1886. icon: "processingAlgorithm.png"
  1887. description: "说明: 一个图层中的线不能与另一个图层中的线相交。第二个图层中的要素与第一个图层中的要素相交的任何线都是错误的。"
  1888. LL02:
  1889. note: "线必须被其他要素类的要素覆盖(线-线)"
  1890. lastupdated: [ 2023-1-4, ]
  1891. roadmap: ""
  1892. front: [ ]
  1893. ARG:
  1894. - intable_s:
  1895. meaning: 输入表的名字
  1896. type: B
  1897. - intable_t:
  1898. meaning: 目标表的名字
  1899. type: B
  1900. RTN:
  1901. - outtable:
  1902. meaning: 输出表的名字
  1903. type: B
  1904. DRTN: { meaning: 正确执行返回1, type: int }
  1905. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  1906. RUNTYPE: repl
  1907. ALG: "drop view if exists LL02view; create view LL02view as
  1908. select c.ogc_fid sid,c.geometry cg, d.ogc_fid did, d.geometry dg
  1909. from idx_@intable_s@_geometry a,
  1910. idx_@intable_t@_geometry b,
  1911. @intable_s@ c,
  1912. @intable_t@ d
  1913. where a.xmax >= b.xmin
  1914. and a.xmin <= b.xmax
  1915. and a.ymax >= b.ymin
  1916. and a.ymin <= b.ymax
  1917. and a.rowid = c.rowid
  1918. and b.rowid = d.rowid
  1919. and intersects(c.geometry, d.geometry)
  1920. order by c.ogc_fid;
  1921. drop table if exists @outtable@;
  1922. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry MULTILINESTRING);
  1923. with sel as
  1924. (
  1925. select sid from LL02view where overlaps(cg,dg) union
  1926. select ogc_fid from @intable_s@ where ogc_fid not in(
  1927. SELECT sid FROM LL02view where equals(cg, dg) or overlaps(cg, dg)
  1928. )
  1929. ), t as
  1930. (
  1931. select c.ogc_fid sid,c.geometry cg, d.ogc_fid did, d.geometry dg
  1932. from idx_@intable_s@_geometry a,
  1933. idx_@intable_t@_geometry b,
  1934. @intable_s@ c,
  1935. @intable_t@ d
  1936. where c.ogc_fid in sel
  1937. and a.xmax >= b.xmin
  1938. and a.xmin <= b.xmax
  1939. and a.ymax >= b.ymin
  1940. and a.ymin <= b.ymax
  1941. and a.rowid = c.rowid
  1942. and b.rowid = d.rowid
  1943. order by sid, did
  1944. ),u as
  1945. (
  1946. select sid, st_difference(cg , gunion(dg) ) geom from t
  1947. group by sid
  1948. )
  1949. insert into @outtable@
  1950. select null,createuuid(),sid,'LL02' rulecode, ExtractMultiLinestring(geom) geometry
  1951. from u
  1952. where ExtractMultiLinestring(geom) is not null;
  1953. 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@'));"
  1954. UI:
  1955. inparam:
  1956. - type: vector
  1957. ARG: intable_s
  1958. name: 输入线图层
  1959. description:
  1960. defaultValue:
  1961. help:
  1962. - type: vector
  1963. ARG: intable_t
  1964. name: 目标线图层
  1965. description:
  1966. defaultValue:
  1967. help:
  1968. outparam:
  1969. - type: databasetable
  1970. ARG: outtable
  1971. name: 输出结果表
  1972. description:
  1973. fileFilter: "gsf;;shp;;spa"
  1974. defaultValue: newTable
  1975. help: ""
  1976. parentLayerParameterName: intable_s
  1977. image: "LL02.png"
  1978. icon: "processingAlgorithm.png"
  1979. description: "说明: 一个图层中的线必须与另一个图层中的线重合。第一个图层中有任何线未与第二个图层的线重合都是错误的。"
  1980. LL03:
  1981. note: "线不能与其他要素重叠(线-线)"
  1982. lastupdated: [ 2023-1-4, ]
  1983. roadmap: ""
  1984. front: [ ]
  1985. ARG:
  1986. - intable_s:
  1987. meaning: 输入表的名字
  1988. type: B
  1989. - intable_t:
  1990. meaning: 目标表的名字
  1991. type: B
  1992. RTN:
  1993. - outtable:
  1994. meaning: 输出表的名字
  1995. type: B
  1996. DRTN: { meaning: 正确执行返回1, type: int }
  1997. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  1998. RUNTYPE: repl
  1999. ALG: "drop table if exists @outtable@;
  2000. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTILINESTRING);
  2001. with t as
  2002. (
  2003. select c.ogc_fid sid, d.ogc_fid did, 'LL03' rulecode,
  2004. ExtractMultiLinestring(intersection(c.geometry, d.geometry)) geometry
  2005. from idx_@intable_s@_geometry a,
  2006. idx_@intable_t@_geometry b,
  2007. @intable_s@ c,
  2008. @intable_t@ d
  2009. where a.xmax >= b.xmin
  2010. and a.xmin <= b.xmax
  2011. and a.ymax >= b.ymin
  2012. and a.ymin <= b.ymax
  2013. and a.rowid = c.rowid
  2014. and b.rowid = d.rowid
  2015. and intersects(c.geometry, d.geometry) = 1
  2016. and ST_Dimension(intersection(c.geometry,d.geometry)) = 1)
  2017. insert into @outtable@
  2018. select null,createuuid(),sid,did,rulecode,geometry from t;
  2019. 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@'));"
  2020. UI:
  2021. inparam:
  2022. - type: vector
  2023. ARG: intable_s
  2024. name: 输入线图层
  2025. description:
  2026. defaultValue:
  2027. help:
  2028. - type: vector
  2029. ARG: intable_t
  2030. name: 目标线图层
  2031. description:
  2032. defaultValue:
  2033. help:
  2034. outparam:
  2035. - type: databasetable
  2036. ARG: outtable
  2037. name: 输出结果表
  2038. description:
  2039. fileFilter: "gsf;;shp;;spa"
  2040. defaultValue: newTable
  2041. help: ""
  2042. parentLayerParameterName: intable_s
  2043. image: "LL03.png"
  2044. icon: "processingAlgorithm.png"
  2045. description: "说明: 一个图层中的线不能与另一个图层中的线重叠。第二个图层中的要素与第一个图层中的要素重叠处的任何线都是错误的。"
  2046. LL04:
  2047. note: "线不能与其他要素相交或内部相连"
  2048. lastupdated: [ 2023-1-4, ]
  2049. roadmap: ""
  2050. front: [ ]
  2051. ARG:
  2052. - intable_s:
  2053. meaning: 输入表的名字
  2054. type: B
  2055. - intable_t:
  2056. meaning: 目标表的名字
  2057. type: B
  2058. RTN:
  2059. - outtableP:
  2060. meaning: 输出点错误表的名字
  2061. type: B
  2062. - outtableL:
  2063. meaning: 输出线错误表的名字
  2064. type: B
  2065. DRTN: { meaning: 正确执行返回1, type: int }
  2066. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出错误表的名字' ]
  2067. RUNTYPE: repl
  2068. ALG: "drop view if exists LL04view;
  2069. create view LL04view as
  2070. select c.ogc_fid sid, d.ogc_fid did,
  2071. numGeometries( intersection( c.geometry, d.geometry )) cnt,
  2072. intersection( c.geometry, d.geometry ) geometry
  2073. from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b,
  2074. @intable_s@ as c, @intable_t@ as d
  2075. where (a.xmin < b.xmax and a.xmax > b.xmin and a.ymin < b.ymax and a.ymax > b.ymin)
  2076. and a.rowid = c.rowid and b.rowid = d.rowid
  2077. and intersects(c.geometry, d.geometry )
  2078. and relate(c.geometry, d.geometry) not like 'FF_F0____';
  2079. drop table if exists @outtable@;
  2080. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTILINESTRING);
  2081. insert into @outtable@
  2082. select null,createuuid(),sid,did, 'LL04' rulecode, ExtractMultiLinestring(geometry) geometry
  2083. from LL04view
  2084. where geometrytype(geometry) like '%LINESTRING'
  2085. order by sid, did;
  2086. 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@'));"
  2087. UI:
  2088. inparam:
  2089. - type: vector
  2090. ARG: intable_s
  2091. name: 输入线图层
  2092. description:
  2093. defaultValue:
  2094. help:
  2095. - type: vector
  2096. ARG: intable_t
  2097. name: 目标线图层
  2098. description:
  2099. defaultValue:
  2100. help:
  2101. outparam:
  2102. - type: databasetable
  2103. ARG: outtable
  2104. name: 输出结果表
  2105. description:
  2106. fileFilter: "gsf;;shp;;spa"
  2107. defaultValue: newTable
  2108. help: ""
  2109. parentLayerParameterName: intable_s
  2110. image: "LL04.png"
  2111. icon: "processingAlgorithm.png"
  2112. description: "说明: 一个图层中的线只能在其端点处与另一图层中的线相接触。任何与要素叠置的线或任何交叉点都是错误的。"
  2113. LA01:
  2114. note: "线必须完全位于面内部"
  2115. lastupdated: [ 2023-1-4, ]
  2116. roadmap: ""
  2117. front: [ ]
  2118. ARG:
  2119. - intable_s:
  2120. meaning: 输入表的名字
  2121. type: B
  2122. - intable_t:
  2123. meaning: 目标表的名字
  2124. type: B
  2125. RTN:
  2126. - outtable:
  2127. meaning: 输出表的名字
  2128. type: B
  2129. DRTN: { meaning: 正确执行返回1, type: int }
  2130. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  2131. RUNTYPE: repl
  2132. ALG: "drop table if exists @outtable@;
  2133. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry LINESTRING);
  2134. insert into @outtable@
  2135. select null,createuuid(),
  2136. ogc_fid sid,
  2137. 'LA01' rulecode,
  2138. geometry geometry
  2139. from @intable_s@
  2140. where rowid not in(
  2141. select a.rowid
  2142. from idx_@intable_s@_geometry a,
  2143. idx_@intable_t@_geometry b,
  2144. @intable_s@ c,
  2145. @intable_t@ d
  2146. where a.xmax >= b.xmin
  2147. and a.xmin <= b.xmax
  2148. and a.ymax >= b.ymin
  2149. and a.ymin <= b.ymax
  2150. and a.rowid = c.rowid
  2151. and b.rowid = d.rowid
  2152. and within(c.geometry, d.geometry) = 1
  2153. and touches(c.geometry, linesfromrings(d.geometry) <> 1)
  2154. );
  2155. 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@'));"
  2156. UI:
  2157. inparam:
  2158. - type: vector
  2159. ARG: intable_s
  2160. name: 输入线图层
  2161. description:
  2162. defaultValue:
  2163. help:
  2164. - type: vector
  2165. ARG: intable_t
  2166. name: 目标面图层
  2167. description:
  2168. defaultValue:
  2169. help:
  2170. outparam:
  2171. - type: databasetable
  2172. ARG: outtable
  2173. name: 输出结果表
  2174. description:
  2175. fileFilter: "gsf;;shp;;spa"
  2176. defaultValue: newTable
  2177. help: ""
  2178. parentLayerParameterName: intable_s
  2179. image: "LA01.png"
  2180. icon: "processingAlgorithm.png"
  2181. description: "说明: 一个图层中的线必须包含在另一个图层的面要素内。第一个图层中未包含在第二个图层面要素内的任何线都是错误的。"
  2182. LA02:
  2183. note: "线必须被其他要素的边界覆盖"
  2184. lastupdated: [ 2023-1-4, ]
  2185. roadmap: "结果创建的是table而不是view"
  2186. front: [ ]
  2187. ARG:
  2188. - intable_s:
  2189. meaning: 输入表的名字
  2190. type: B
  2191. - intable_t:
  2192. meaning: 目标表的名字
  2193. type: B
  2194. RTN:
  2195. - outtable:
  2196. meaning: 输出表的名字
  2197. type: B
  2198. DRTN: { meaning: 正确执行返回1, type: int }
  2199. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  2200. RUNTYPE: repl
  2201. ALG: "drop view if exists LA02view;
  2202. create view LA02view as
  2203. select c.ogc_fid sid,c.geometry cg, d.ogc_fid did, linesfromrings(d.geometry) dg
  2204. from idx_@intable_s@_geometry a,
  2205. idx_@intable_t@_geometry b,
  2206. @intable_s@ c,
  2207. @intable_t@ d
  2208. where a.xmax >= b.xmin
  2209. and a.xmin <= b.xmax
  2210. and a.ymax >= b.ymin
  2211. and a.ymin <= b.ymax
  2212. and a.rowid = c.rowid
  2213. and b.rowid = d.rowid
  2214. and intersects(c.geometry, linesfromrings(d.geometry))
  2215. and relate(c.geometry, linesfromrings(d.geometry)) like '1%'
  2216. order by c.ogc_fid;
  2217. drop table if exists @outtable@;
  2218. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTILINESTRING);
  2219. with t1 as
  2220. (
  2221. select sid, group_concat(did, '-') did, 'LA02' rulecode,
  2222. ExtractMultiLinestring(st_difference(cg, gunion(dg))) geometry
  2223. from LA02view
  2224. group by sid
  2225. having geometry is not null)
  2226. insert into @outtable@
  2227. select null,createuuid(),sid,did,rulecode,geometry from t1;
  2228. with t2 as
  2229. (
  2230. select createuuid(),ogc_fid sid, null did, 'LA02' rulecode , ExtractMultiLinestring(geometry) geometry
  2231. from @intable_s@
  2232. where ogc_fid not in (select sid from LA02view))
  2233. insert into @outtable@
  2234. select null,createuuid(),sid,did,rulecode,geometry from t2;
  2235. 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@'));"
  2236. UI:
  2237. inparam:
  2238. - type: vector
  2239. ARG: intable_s
  2240. name: 输入线图层
  2241. description:
  2242. defaultValue:
  2243. help:
  2244. - type: vector
  2245. ARG: intable_t
  2246. name: 目标面图层
  2247. description:
  2248. defaultValue:
  2249. help:
  2250. outparam:
  2251. - type: databasetable
  2252. ARG: outtable
  2253. name: 输出结果表
  2254. description:
  2255. fileFilter: "gsf;;shp;;spa"
  2256. defaultValue: newTable
  2257. help: ""
  2258. parentLayerParameterName: intable_s
  2259. image: "LA02.png"
  2260. icon: "processingAlgorithm.png"
  2261. description: "说明: 一个图层中的线要素必须与另一个图层面要素的边界重合。线图层要素中与面图层边界不重合的任何线都是错误的。"
  2262. LA03:
  2263. note: "线不能与面重叠"
  2264. lastupdated: [ 2023-1-4, ]
  2265. roadmap: ""
  2266. front: [ ]
  2267. ARG:
  2268. - intable_s:
  2269. meaning: 输入表的名字
  2270. type: B
  2271. - intable_t:
  2272. meaning: 目标表的名字
  2273. type: B
  2274. RTN:
  2275. - outtable:
  2276. meaning: 输出表的名字
  2277. type: B
  2278. DRTN: { meaning: 正确执行返回1, type: int }
  2279. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  2280. RUNTYPE: repl
  2281. ALG: "drop table if exists @outtable@;
  2282. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTILINESTRING);
  2283. with t as(
  2284. select c.ogc_fid sid, d.ogc_fid did, 'LA03' rulecode,
  2285. ExtractMultiLinestring(intersection(c.geometry, d.geometry) ) geometry
  2286. from idx_@intable_s@_geometry a, idx_@intable_t@_geometry b, @intable_s@ c, @intable_t@ d
  2287. where a.xmax >= b.xmin and a.xmin <= b.xmax and a.ymax >= b.ymin and a.ymin <= b.ymax
  2288. and a.rowid = c.rowid and b.rowid = d.rowid
  2289. and ( crosses(c.geometry, d.geometry) or within(c.geometry, d.geometry) )
  2290. and ExtractMultiLinestring(intersection(c.geometry, d.geometry) ) is not null)
  2291. insert into @outtable@
  2292. select null,createuuid(),sid,did,rulecode,geometry from t;
  2293. 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@'));"
  2294. UI:
  2295. inparam:
  2296. - type: vector
  2297. ARG: intable_s
  2298. name: 输入线图层
  2299. description:
  2300. defaultValue:
  2301. help:
  2302. - type: vector
  2303. ARG: intable_t
  2304. name: 目标面图层
  2305. description:
  2306. defaultValue:
  2307. help:
  2308. outparam:
  2309. - type: databasetable
  2310. ARG: outtable
  2311. name: 输出结果表
  2312. description:
  2313. fileFilter: "gsf;;shp;;spa"
  2314. defaultValue: newTable
  2315. help: ""
  2316. parentLayerParameterName: intable_s
  2317. image: "LA03.png"
  2318. icon: "processingAlgorithm.png"
  2319. description: "说明: 一个图层中的线不能与另一个图层中的面重叠。第二个图层中的要素与第一个图层中的要素重叠处的任何区域都是错误的。"
  2320. AP01:
  2321. note: "面必须包含点"
  2322. lastupdated: [ 2023-1-4, ]
  2323. roadmap: ""
  2324. front: [ ]
  2325. ARG:
  2326. - intable_s:
  2327. meaning: 输入表的名字
  2328. type: B
  2329. - intable_t:
  2330. meaning: 目标表的名字
  2331. type: B
  2332. RTN:
  2333. - outtable:
  2334. meaning: 输出表的名字
  2335. type: B
  2336. DRTN: { meaning: 正确执行返回1, type: int }
  2337. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  2338. RUNTYPE: repl
  2339. ALG: "drop table if exists @outtable@;
  2340. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POLYGON);
  2341. insert into @outtable@
  2342. select null,createuuid(),
  2343. ogc_fid sid,
  2344. 'AP01' rulecode,
  2345. geometry geometry
  2346. from @intable_s@
  2347. where rowid not in(
  2348. select a.rowid
  2349. from idx_@intable_s@_geometry a,
  2350. idx_@intable_t@_geometry b,
  2351. @intable_s@ c,
  2352. @intable_t@ d
  2353. where a.xmax >= b.xmin
  2354. and a.xmin <= b.xmax
  2355. and a.ymax >= b.ymin
  2356. and a.ymin <= b.ymax
  2357. and a.rowid = c.rowid
  2358. and b.rowid = d.rowid
  2359. and contains(c.geometry, d.geometry) = 1
  2360. order by a.rowid
  2361. );
  2362. 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@'));"
  2363. UI:
  2364. inparam:
  2365. - type: vector
  2366. ARG: intable_s
  2367. name: 输入面图层
  2368. description:
  2369. defaultValue:
  2370. help:
  2371. - type: vector
  2372. ARG: intable_t
  2373. name: 目标点图层
  2374. description:
  2375. defaultValue:
  2376. help:
  2377. outparam:
  2378. - type: databasetable
  2379. ARG: outtable
  2380. name: 输出结果表
  2381. description:
  2382. fileFilter: "gsf;;shp;;spa"
  2383. defaultValue: newTable
  2384. help: ""
  2385. parentLayerParameterName: intable_s
  2386. image: "AP01.png"
  2387. icon: "processingAlgorithm.png"
  2388. description: "说明: 一个图层中的面要素必须至少包含另一个图层中的一个点要素。任何不包含至少一个点要素的面要素都是错误的。"
  2389. AP02:
  2390. note: "面只能包含一个点(面的内部的点个数不是1(0,2...))"
  2391. lastupdated: [ 2023-1-4, ]
  2392. roadmap: ""
  2393. front: [ ]
  2394. ARG:
  2395. - intable_s:
  2396. meaning: 输入表的名字
  2397. type: B
  2398. - intable_t:
  2399. meaning: 目标表的名字
  2400. type: B
  2401. RTN:
  2402. - outtable:
  2403. meaning: 输出表的名字
  2404. type: B
  2405. DRTN: { meaning: 正确执行返回1, type: int }
  2406. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  2407. RUNTYPE: repl
  2408. ALG: "drop table if exists @outtable@;
  2409. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POLYGON);
  2410. insert into @outtable@
  2411. select null,createuuid(),
  2412. ogc_fid sid,
  2413. 'AP02' rulecode,
  2414. geometry geometry
  2415. from @intable_s@
  2416. where rowid not in(
  2417. select c.rowid sid
  2418. from idx_@intable_s@_geometry a,
  2419. idx_@intable_t@_geometry b,
  2420. @intable_s@ c,
  2421. @intable_t@ d
  2422. where (
  2423. b.xmax >= a.xmin
  2424. and b.xmin <= a.xmax
  2425. and b.ymax >= a.ymin
  2426. and b.ymin <= a.ymax
  2427. )
  2428. and a.rowid = c.rowid
  2429. and b.rowid = d.rowid
  2430. and contains(c.geometry, d.geometry) = 1
  2431. group by sid
  2432. having count(d.rowid) = 1
  2433. );
  2434. 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@'));"
  2435. UI:
  2436. inparam:
  2437. - type: vector
  2438. ARG: intable_s
  2439. name: 输入面图层
  2440. description:
  2441. defaultValue:
  2442. help:
  2443. - type: vector
  2444. ARG: intable_t
  2445. name: 目标点图层
  2446. description:
  2447. defaultValue:
  2448. help:
  2449. outparam:
  2450. - type: databasetable
  2451. ARG: outtable
  2452. name: 输出结果表
  2453. description:
  2454. fileFilter: "gsf;;shp;;spa"
  2455. defaultValue: newTable
  2456. help: ""
  2457. parentLayerParameterName: intable_s
  2458. image: "AP02.png"
  2459. icon: "processingAlgorithm.png"
  2460. description: "说明: 一个图层中的面要素必须完全包含另一个图层中的一个点要素。任何未完全包含一个点要素的面要素都是错误的。"
  2461. AL01:
  2462. note: "面边界必须被其他要素覆盖(面-线)"
  2463. lastupdated: [ 2023-1-4, ]
  2464. roadmap: ""
  2465. front: [ ]
  2466. ARG:
  2467. - intable_s:
  2468. meaning: 输入表的名字
  2469. type: B
  2470. - intable_t:
  2471. meaning: 目标表的名字
  2472. type: B
  2473. RTN:
  2474. - outtable:
  2475. meaning: 输出表的名字
  2476. type: B
  2477. DRTN: { meaning: 正确执行返回1, type: int }
  2478. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  2479. RUNTYPE: repl
  2480. ALG: "drop table if exists @outtable@;
  2481. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry MULTILINESTRING);
  2482. with t1 as(
  2483. select c.ogc_fid sid,linesfromrings(c.geometry) cg, d.ogc_fid did, d.geometry dg
  2484. from idx_@intable_s@_geometry a,
  2485. idx_@intable_t@_geometry b,
  2486. @intable_s@ c,
  2487. @intable_t@ d
  2488. where a.xmax >= b.xmin
  2489. and a.xmin <= b.xmax
  2490. and a.ymax >= b.ymin
  2491. and a.ymin <= b.ymax
  2492. and a.rowid = c.rowid
  2493. and b.rowid = d.rowid
  2494. and intersects(linesfromrings(c.geometry), d.geometry)
  2495. and ST_Dimension(intersection(linesfromrings(c.geometry), d.geometry)) = 1
  2496. order by c.ogc_fid, d.ogc_fid
  2497. ) ,
  2498. t2 as(
  2499. select sid,'AL01' rulecode, casttomulti(st_difference(cg, gunion(dg))) geometry
  2500. from t1 group by sid)
  2501. insert into @outtable@
  2502. select null,createuuid(),
  2503. sid,rulecode,geometry
  2504. from t2 where geometry is not null;
  2505. insert into @outtable@
  2506. select null,createuuid(),
  2507. ogc_fid sid,'AL01' rulecode, casttomulti(linesfromrings(geometry)) geometry
  2508. from @intable_s@ where rowid not in(
  2509. select c.rowid sid
  2510. from idx_@intable_s@_geometry a,
  2511. idx_@intable_t@_geometry b,
  2512. @intable_s@ c,
  2513. @intable_t@ d
  2514. where a.xmax >= b.xmin
  2515. and a.xmin <= b.xmax
  2516. and a.ymax >= b.ymin
  2517. and a.ymin <= b.ymax
  2518. and a.rowid = c.rowid
  2519. and b.rowid = d.rowid
  2520. and intersects(linesfromrings(c.geometry), d.geometry)
  2521. and ST_Dimension(intersection(linesfromrings(c.geometry), d.geometry)) = 1
  2522. order by c.rowid, d.rowid
  2523. );
  2524. 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@'));"
  2525. UI:
  2526. inparam:
  2527. - type: vector
  2528. ARG: intable_s
  2529. name: 输入面图层
  2530. description:
  2531. defaultValue:
  2532. help:
  2533. - type: vector
  2534. ARG: intable_t
  2535. name: 目标线图层
  2536. description:
  2537. defaultValue:
  2538. help:
  2539. outparam:
  2540. - type: databasetable
  2541. ARG: outtable
  2542. name: 输出结果表
  2543. description:
  2544. fileFilter: "gsf;;shp;;spa"
  2545. defaultValue: newTable
  2546. help: ""
  2547. parentLayerParameterName: intable_s
  2548. image: "AL01.png"
  2549. icon: "processingAlgorithm.png"
  2550. description: "说明: 一个图层中面要素的边界必须被另一个图层的线要素覆盖。未与线要素重合的面要素边界是错误的。"
  2551. AA01:
  2552. note: "面不与其他要素重叠(面-面)"
  2553. lastupdated: [ 2023-1-4, ]
  2554. roadmap: ""
  2555. front: [ ]
  2556. ARG:
  2557. - intable_s:
  2558. meaning: 输入表的名字
  2559. type: B
  2560. - intable_t:
  2561. meaning: 目标表的名字
  2562. type: B
  2563. RTN:
  2564. - outtable:
  2565. meaning: 输出表的名字
  2566. type: B
  2567. DRTN: { meaning: 正确执行返回1, type: int }
  2568. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  2569. RUNTYPE: repl
  2570. ALG: "drop table if exists @outtable@;
  2571. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry POLYGON);
  2572. with t as(
  2573. select c.ogc_fid sid, d.ogc_fid did,
  2574. numGeometries(intersection(c.geometry, d.geometry)) cnt,
  2575. intersection(c.geometry, d.geometry) geometry
  2576. from idx_@intable_s@_geometry a,
  2577. idx_@intable_t@_geometry b,
  2578. @intable_s@ as c,
  2579. @intable_t@ as d
  2580. where (
  2581. a.xmin < b.xmax
  2582. and a.xmax > b.xmin
  2583. and a.ymin < b.ymax
  2584. and a.ymax > b.ymin
  2585. )
  2586. and a.rowid = c.rowid
  2587. and b.rowid = d.rowid
  2588. and intersects(c.geometry, d.geometry) = 1
  2589. and ST_Dimension(intersection(c.geometry, d.geometry)) > 1
  2590. ),
  2591. cte(idx, sid, did, cnt, geometry, subgeom) AS (
  2592. SELECT 1 idx,
  2593. sid,
  2594. did,
  2595. cnt,
  2596. geometry,
  2597. geometryN(geometry, 1) subgeom
  2598. from t
  2599. UNION ALL
  2600. SELECT idx + 1 idx,
  2601. sid,
  2602. did,
  2603. cnt,
  2604. geometry,
  2605. geometryN(geometry, idx + 1) subgeom
  2606. FROM cte
  2607. WHERE idx < cnt
  2608. )
  2609. insert into @outtable@
  2610. SELECT null,createuuid(),
  2611. sid,
  2612. did,
  2613. 'AA01' rulecode,
  2614. subgeom geometry
  2615. FROM cte
  2616. where geometrytype(subgeom) = 'POLYGON'
  2617. order by sid,
  2618. did;
  2619. 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@'));"
  2620. UI:
  2621. inparam:
  2622. - type: vector
  2623. ARG: intable_s
  2624. name: 输入面图层
  2625. description:
  2626. defaultValue:
  2627. help:
  2628. - type: vector
  2629. ARG: intable_t
  2630. name: 目标面图层
  2631. description:
  2632. defaultValue:
  2633. help:
  2634. outparam:
  2635. - type: databasetable
  2636. ARG: outtable
  2637. name: 输出结果表
  2638. description:
  2639. fileFilter: "gsf;;shp;;spa"
  2640. defaultValue: newTable
  2641. help: ""
  2642. parentLayerParameterName: intable_s
  2643. image: "AA01.png"
  2644. icon: "processingAlgorithm.png"
  2645. description: "说明: 一个图层中的区域不能与另一个图层中的区域重叠。第二个图层中的要素与第一个图层中的要素重叠处的任何区域都是错误的。"
  2646. AA02:
  2647. note: "面必须被其他要素类的要素覆盖"
  2648. lastupdated: [ 2023-1-4, ]
  2649. roadmap: ""
  2650. front: [ ]
  2651. ARG:
  2652. - intable_s:
  2653. meaning: 输入表的名字
  2654. type: B
  2655. - intable_t:
  2656. meaning: 目标表的名字
  2657. type: B
  2658. RTN:
  2659. - outtable:
  2660. meaning: 输出表的名字
  2661. type: B
  2662. DRTN: { meaning: 正确执行返回1, type: int }
  2663. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  2664. RUNTYPE: repl
  2665. ALG: "drop view if exists AA02view;
  2666. create view AA02view as
  2667. select c.ogc_fid cid, d.ogc_fid did, c.geometry cg, d.geometry dg
  2668. from idx_@intable_s@_geometry a,
  2669. idx_@intable_t@_geometry b,
  2670. @intable_s@ c,
  2671. @intable_t@ d
  2672. where a.xmax >= b.xmin
  2673. and a.xmin <= b.xmax
  2674. and a.ymax >= b.ymin
  2675. and a.ymin <= b.ymax
  2676. and a.rowid = c.rowid
  2677. and b.rowid = d.rowid
  2678. and intersects(c.geometry, d.geometry);
  2679. drop table if exists @outtable@;
  2680. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTIPOLYGON);
  2681. insert into @outtable@
  2682. select null,createuuid(),cid sid, ids did, 'AA02' rilecode, geom geometry from (
  2683. select cid, group_concat(did, '-') ids, ExtractMultiPolygon(ST_Difference(cg, gunion(dg))) geom
  2684. from AA02view
  2685. group by cid
  2686. ) where geom is not null;
  2687. insert into @outtable@
  2688. select null,createuuid(),ogc_fid sid, null did, 'AA02' rulecode, casttomulti(geometry) geometry from @intable_s@
  2689. where ogc_fid not in (select cid from AA02view);
  2690. 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@'));"
  2691. UI:
  2692. inparam:
  2693. - type: vector
  2694. ARG: intable_s
  2695. name: 输入面图层
  2696. description:
  2697. defaultValue:
  2698. help:
  2699. - type: vector
  2700. ARG: intable_t
  2701. name: 目标面图层
  2702. description:
  2703. defaultValue:
  2704. help:
  2705. outparam:
  2706. - type: databasetable
  2707. ARG: outtable
  2708. name: 输出结果表
  2709. description:
  2710. fileFilter: "gsf;;shp;;spa"
  2711. defaultValue: newTable
  2712. help: ""
  2713. parentLayerParameterName: intable_s
  2714. image: "AA02.png"
  2715. icon: "processingAlgorithm.png"
  2716. description: "说明: 一个图层的面要素必须覆盖另一个图层的面要素。如果任何区域中第一个图层中的要素没有被第二个图层中的要素覆盖,该区域都是错误的。"
  2717. AA03:
  2718. note: "面必须互相覆盖"
  2719. lastupdated: [ 2023-1-4, ]
  2720. roadmap: ""
  2721. front: [ ]
  2722. ARG:
  2723. - intable_s:
  2724. meaning: 输入表的名字
  2725. type: B
  2726. - intable_t:
  2727. meaning: 目标表的名字
  2728. type: B
  2729. RTN:
  2730. - outtable:
  2731. meaning: 输出表的名字
  2732. type: B
  2733. DRTN: { meaning: 正确执行返回1, type: int }
  2734. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  2735. RUNTYPE: repl
  2736. ALG: "drop view if exists AA03view;
  2737. create view AA03view as
  2738. select c.ogc_fid cid, d.ogc_fid did, c.geometry cg, d.geometry dg
  2739. from idx_@intable_s@_geometry a,
  2740. idx_@intable_t@_geometry b,
  2741. @intable_s@ c,
  2742. @intable_t@ d
  2743. where a.xmax >= b.xmin
  2744. and a.xmin <= b.xmax
  2745. and a.ymax >= b.ymin
  2746. and a.ymin <= b.ymax
  2747. and a.rowid = c.rowid
  2748. and b.rowid = d.rowid
  2749. and intersects(c.geometry, d.geometry)
  2750. and not touches(c.geometry, d.geometry);
  2751. drop table if exists @outtable@;
  2752. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,did,rulecode,geometry MULTIPOLYGON);
  2753. insert into @outtable@
  2754. select null,createuuid(), cid sid, ids did, 'AA03' rilecode, geom geometry from (
  2755. select cid, group_concat(did, '-') ids, ExtractMultiPolygon(ST_Difference(cg, gunion(dg))) geom from AA03view
  2756. group by cid
  2757. ) where geom is not null;
  2758. insert into @outtable@
  2759. select null,createuuid(),ids sid, did ,'AA03' rilecode, geom geometry from (
  2760. select did, group_concat(cid, '-') ids, ExtractMultiPolygon(ST_Difference(dg, gunion(cg))) geom from AA03view
  2761. group by did
  2762. ) where geom is not null;
  2763. insert into @outtable@
  2764. select null,createuuid(), ogc_fid sid, null did, 'AA03' rulecode, casttomulti(geometry) geometry
  2765. from @intable_s@ where ogc_fid not in (select cid from AA03view);
  2766. insert into @outtable@
  2767. select null,createuuid(),null sid, ogc_fid did, 'AA03' rulecode, casttomulti(geometry) geometry
  2768. from @intable_t@ where ogc_fid not in (select did from AA03view);
  2769. 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@'));"
  2770. UI:
  2771. inparam:
  2772. - type: vector
  2773. ARG: intable_s
  2774. name: 输入面图层
  2775. description:
  2776. defaultValue:
  2777. help:
  2778. - type: vector
  2779. ARG: intable_t
  2780. name: 目标面图层
  2781. description:
  2782. defaultValue:
  2783. help:
  2784. outparam:
  2785. - type: databasetable
  2786. ARG: outtable
  2787. name: 输出结果表
  2788. description:
  2789. fileFilter: "gsf;;shp;;spa"
  2790. defaultValue: newTable
  2791. help: ""
  2792. parentLayerParameterName: intable_s
  2793. image: "AA03.png"
  2794. icon: "processingAlgorithm.png"
  2795. description: "说明: 一个图层的面要素必须与另一个图层的面要素互相覆盖。如果在任何区域中一个图层的要素未覆盖另一个图层的要素,该区域都是错误的。"
  2796. AA04:
  2797. note: "面必须被单个面覆盖(村必须在某个乡镇之内)"
  2798. lastupdated: [ 2023-1-4, ]
  2799. roadmap: ""
  2800. front: [ ]
  2801. ARG:
  2802. - intable_s:
  2803. meaning: 输入表的名字
  2804. type: B
  2805. - intable_t:
  2806. meaning: 目标表的名字
  2807. type: B
  2808. RTN:
  2809. - outtable:
  2810. meaning: 输出表的名字
  2811. type: B
  2812. DRTN: { meaning: 正确执行返回1, type: int }
  2813. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  2814. RUNTYPE: repl
  2815. ALG: "drop table if exists @outtable@;
  2816. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry POLYGON);
  2817. insert into @outtable@
  2818. select null,createuuid(), ogc_fid sid, 'AA04' rulecode, geometry geometry
  2819. from @intable_s@ where rowid not in(
  2820. select a.rowid
  2821. from idx_@intable_s@_geometry a,
  2822. idx_@intable_t@_geometry b,
  2823. @intable_s@ c,
  2824. @intable_t@ d
  2825. where a.xmax >= b.xmin
  2826. and a.xmin <= b.xmax
  2827. and a.ymax >= b.ymin
  2828. and a.ymin <= b.ymax
  2829. and a.rowid = c.rowid
  2830. and b.rowid = d.rowid
  2831. and intersects(c.geometry, d.geometry)
  2832. and within(c.geometry, d.geometry)
  2833. );
  2834. 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@'));"
  2835. UI:
  2836. inparam:
  2837. - type: vector
  2838. ARG: intable_s
  2839. name: 输入面图层
  2840. description:
  2841. defaultValue:
  2842. help:
  2843. - type: vector
  2844. ARG: intable_t
  2845. name: 目标面图层
  2846. description:
  2847. defaultValue:
  2848. help:
  2849. outparam:
  2850. - type: databasetable
  2851. ARG: outtable
  2852. name: 输出结果表
  2853. description:
  2854. fileFilter: "gsf;;shp;;spa"
  2855. defaultValue: newTable
  2856. help: ""
  2857. parentLayerParameterName: intable_s
  2858. image: "AA04.png"
  2859. icon: "processingAlgorithm.png"
  2860. description: "说明:一个图层中的面要素必须包含在另一个图层的面要素内。第一个图层中的任何面要素未包含在第二个图层的要素内都是错误的。"
  2861. AA05:
  2862. note: "面边界必须被其他要素边界覆盖(面-面)"
  2863. lastupdated: [ 2023-1-4, ]
  2864. roadmap: ""
  2865. front: [ ]
  2866. ARG:
  2867. - intable_s:
  2868. meaning: 输入表的名字
  2869. type: B
  2870. - intable_t:
  2871. meaning: 目标表的名字
  2872. type: B
  2873. RTN:
  2874. - outtable:
  2875. meaning: 输出表的名字
  2876. type: B
  2877. DRTN: { meaning: 正确执行返回1, type: int }
  2878. RARG: [ '@intable_s@=输入表的名字','@intable_t@=目标表的名字','@outtable@=输出表的名字' ]
  2879. RUNTYPE: repl
  2880. ALG: "drop view if exists AA05view;
  2881. create view AA05view as
  2882. select c.ogc_fid sid,linesfromrings(c.geometry) cg, d.ogc_fid did, linesfromrings(d.geometry) dg
  2883. from idx_@intable_s@_geometry a,
  2884. idx_@intable_t@_geometry b,
  2885. @intable_s@ c,
  2886. @intable_t@ d
  2887. where a.xmax >= b.xmin
  2888. and a.xmin <= b.xmax
  2889. and a.ymax >= b.ymin
  2890. and a.ymin <= b.ymax
  2891. and a.rowid = c.rowid
  2892. and b.rowid = d.rowid
  2893. and intersects(linesfromrings(c.geometry), linesfromrings(d.geometry))
  2894. order by c.ogc_fid;
  2895. drop table if exists @outtable@;
  2896. create table @outtable@(ID INTEGER PRIMARY KEY not null,UUID VARCHAR(128),sid,rulecode,geometry MULTILINESTRING);
  2897. with sel as
  2898. (
  2899. select sid from AA05view where overlaps(cg,dg) union
  2900. select ogc_fid from @intable_s@ where ogc_fid not in(
  2901. SELECT sid FROM AA05view where equals(cg, dg) or overlaps(cg, dg)
  2902. )
  2903. ), t as
  2904. (
  2905. select c.ogc_fid sid,linesfromrings(c.geometry) cg, d.ogc_fid did, linesfromrings(d.geometry) dg
  2906. from idx_@intable_s@_geometry a,
  2907. idx_@intable_t@_geometry b,
  2908. @intable_s@ c,
  2909. @intable_t@ d
  2910. where c.ogc_fid in sel
  2911. and a.xmax >= b.xmin
  2912. and a.xmin <= b.xmax
  2913. and a.ymax >= b.ymin
  2914. and a.ymin <= b.ymax
  2915. and a.rowid = c.rowid
  2916. and b.rowid = d.rowid
  2917. order by sid, did
  2918. ),u as
  2919. (
  2920. select sid, st_difference(cg , gunion(dg) ) geom from t
  2921. group by sid
  2922. )
  2923. insert into @outtable@
  2924. select null,createuuid(),sid,'AA05' rulecode, ExtractMultiLinestring(geom) geometry
  2925. from u
  2926. where ExtractMultiLinestring(geom) is not null;
  2927. 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@'));"
  2928. UI:
  2929. inparam:
  2930. - type: vector
  2931. ARG: intable_s
  2932. name: 输入面图层
  2933. description:
  2934. defaultValue:
  2935. help:
  2936. - type: vector
  2937. ARG: intable_t
  2938. name: 目标面图层
  2939. description:
  2940. defaultValue:
  2941. help:
  2942. outparam:
  2943. - type: databasetable
  2944. ARG: outtable
  2945. name: 输出结果表
  2946. description:
  2947. fileFilter: "gsf;;shp;;spa"
  2948. defaultValue: newTable
  2949. help: ""
  2950. parentLayerParameterName: intable_s
  2951. image: "AA05.png"
  2952. icon: "processingAlgorithm.png"
  2953. description: "说明: 一个图层中面要素的边界必须被另一个图层中面要素的边界覆盖。第一个图层中任何未被第二个图层中面要素的边界覆盖的面要素边界都是错误的。"