1\set VERBOSITY terse
2set client_min_messages to WARNING;
3
4
5--------------------------------------------------------
6-- See https://trac.osgeo.org/postgis/ticket/4851
7--------------------------------------------------------
8
9select NULL FROM createtopology('tt');
10
11-- Create simple puntal layer (will be layer 1)
12CREATE TABLE tt.f_puntal(id serial);
13SELECT 'simple_puntual_layer', AddTopoGeometryColumn('tt', 'tt', 'f_puntal','g','POINT');
14
15-- Create a lineal layer (will be layer 2)
16CREATE TABLE tt.f_lineal(id serial);
17SELECT 'simple_lineal_layer', AddTopoGeometryColumn('tt', 'tt', 'f_lineal','g','LINE');
18
19-- Create an areal layer (will be layer 3)
20CREATE TABLE tt.f_areal(id serial);
21SELECT 'simple_areal_layer', AddTopoGeometryColumn('tt', 'tt', 'f_areal','g','POLYGON');
22
23-- Create a collection layer (will be layer 4)
24CREATE TABLE tt.f_coll(id serial);
25SELECT 'simple_collection_layer', AddTopoGeometryColumn('tt', 'tt', 'f_coll','g','COLLECTION');
26
27-- Create a hierarchical puntal layer (will be layer 5)
28CREATE TABLE tt.f_hier_puntal(id serial);
29SELECT 'hierarchical_puntual_layer', AddTopoGeometryColumn('tt', 'tt', 'f_hier_puntal','g','POINT', 1);
30
31
32-- point to point
33SELECT 'tg2tg.poi2poi', ST_AsText(TopoGeom_addTopoGeom(
34    toTopoGeom('POINT(1 1)', 'tt', 1),
35    toTopoGeom('POINT(0 0)', 'tt', 1)
36));
37
38-- point to mixed
39SELECT 'tg2tg.poi2mix', ST_AsText(TopoGeom_addTopoGeom(
40    toTopoGeom('LINESTRING(1 1, 0 0)', 'tt', 4),
41    toTopoGeom('POINT(0 0)', 'tt', 1)
42));
43
44-- line to line
45SELECT 'tg2tg.lin2lin', ST_AsText(TopoGeom_addTopoGeom(
46    toTopoGeom('LINESTRING(0 1, 2 1)', 'tt', 2),
47    toTopoGeom('LINESTRING(0 0, 2 0)', 'tt', 2)
48));
49
50-- line to mixed
51SELECT 'tg2tg.lin2mix', ST_AsText(TopoGeom_addTopoGeom(
52    toTopoGeom('POINT(0 0)', 'tt', 4),
53    toTopoGeom('LINESTRING(0 0, 2 0)', 'tt', 2)
54));
55
56-- poly to poly
57SELECT 'tg2tg.pol2pol', ST_AsText(ST_Simplify(ST_Normalize(TopoGeom_addTopoGeom(
58    toTopoGeom(ST_MakeEnvelope(0,10,20,10), 'tt', 3),
59    toTopoGeom(ST_MakeEnvelope(0,0,10,10), 'tt', 3)
60)::geometry), 0));
61
62-- poly to mixed
63SELECT 'tg2tg.pol2pol', ST_AsText(ST_Simplify(ST_Normalize(TopoGeom_addTopoGeom(
64    toTopoGeom(ST_MakePoint(0,0), 'tt', 4),
65    toTopoGeom(ST_MakeEnvelope(0,0,10,10), 'tt', 4)
66)::geometry), 0));
67
68-- TODO: point to point (hierarchical)
69-- TODO: point to mixed (hierarchical)
70-- TODO: line to line (hierarchical)
71-- TODO: line to mixed (hierarchical)
72-- TODO: poly to poly (hierarchical)
73-- TODO: poly to mixed (hierarchical)
74-- TODO: BOGUS calls (incompatible merges)
75
76DROP TABLE tt.f_coll;
77DROP TABLE tt.f_areal;
78DROP TABLE tt.f_lineal;
79DROP TABLE tt.f_hier_puntal;
80DROP TABLE tt.f_puntal;
81select NULL from droptopology('tt');
82