File: validatetopologyrelation.sql

package info (click to toggle)
postgis 3.3.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 87,748 kB
  • sloc: ansic: 158,671; sql: 91,546; xml: 54,004; cpp: 12,339; sh: 5,187; perl: 5,100; makefile: 3,085; python: 1,205; yacc: 447; lex: 151; javascript: 6
file content (50 lines) | stat: -rw-r--r-- 1,249 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

\set VERBOSITY terse
set client_min_messages to ERROR;

\i :top_builddir/topology/test/load_topology.sql
\i ../load_features.sql
\i ../hierarchy.sql
--\i ../more_features.sql

SELECT 'valid-start', * FROM topology.ValidateTopologyRelation('city_data');

-- Delete all primitives
DELETE FROM city_data.edge_data;
DELETE FROM city_data.node;
DELETE FROM city_data.face WHERE face_id > 0;

SELECT 'invalid-primitives', * FROM topology.ValidateTopologyRelation('city_data')
ORDER BY 3,4,5;

-- Delete features from primitive tables
WITH
deleted_land_parcels AS (
  DELETE FROM features.land_parcels
  RETURNING feature
),
deleted_traffic_signs AS (
  DELETE FROM features.traffic_signs
  RETURNING feature
),
deleted_city_streets AS (
  DELETE FROM features.city_streets
  RETURNING feature
)
SELECT NULL FROM (
  SELECT ClearTopoGeom(feature) FROM deleted_land_parcels
    UNION
  SELECT ClearTopoGeom(feature) FROM deleted_traffic_signs
    UNION
  SELECT ClearTopoGeom(feature) FROM deleted_city_streets
) foo
;

SELECT 'invalid-hierarchical', * FROM topology.ValidateTopologyRelation('city_data')
ORDER BY 3,4,5;

--SELECT * FROM topology.layer WHERE child_id IS NOT NULL;

SELECT topology.DropTopology('city_data');
DROP SCHEMA features CASCADE;