~ubuntu-branches/ubuntu/trusty/postgis/trusty-security

« back to all changes in this revision

Viewing changes to regress/regress_ogc_prep.sql

  • Committer: Bazaar Package Importer
  • Author(s): Francesco Paolo Lovergine
  • Date: 2009-12-11 13:10:34 UTC
  • mfrom: (1.1.9 upstream) (5.2.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20091211131034-wmsz69wxvt95pe5r
Tags: 1.4.0-2
* Upload to unstable.
* Better parameterized debian/rules against postgis $(VERSION).
* Added dblatex and libcunit1-dev among build-deps.
* Added postgis_comments.sql to contrib/ SQL templates.
* Dropping 8.3 support, no more supported for squeeze.
  (closes: #559587)
* Do not stop on error in postrm if the target dir does not exist.
  (closes: #560409)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
---
4
4
---
5
5
 
6
 
CREATE TABLE ogc_prep (
7
 
        c VARCHAR,
8
 
        g1 GEOMETRY,
9
 
        g2 GEOMETRY
10
 
);
11
 
 
12
 
INSERT INTO ogc_prep (c, g1, g2) 
13
 
        VALUES ('099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)');
14
 
INSERT INTO ogc_prep (c, g1, g2) 
15
 
        VALUES ('100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)');
16
 
INSERT INTO ogc_prep (c, g1, g2) 
17
 
        VALUES ('101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)');
18
 
INSERT INTO ogc_prep (c, g1, g2) 
19
 
        VALUES ('102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)');
20
 
INSERT INTO ogc_prep (c, g1, g2) 
21
 
        VALUES ('103', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 5)');
22
 
INSERT INTO ogc_prep (c, g1, g2) 
23
 
        VALUES ('104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)');
24
 
        
25
 
SELECT 'intersects' || c, ST_Intersects(g1, g2) FROM ogc_prep ORDER BY c;
26
 
SELECT 'contains' || c, ST_Contains(g1, g2) FROM ogc_prep ORDER BY c;
27
 
SELECT 'covers' || c, ST_Covers(g1, g2) FROM ogc_prep ORDER BY c;
28
 
SELECT 'containsproperly' || c, ST_ContainsProperly(g1, g2) FROM ogc_prep ORDER BY c;
29
 
 
30
 
INSERT INTO ogc_prep (c, g1, g2)
31
 
        VALUES ('105', ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631) );
32
 
INSERT INTO ogc_prep (c, g1, g2)
33
 
        VALUES ('105', ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631) );
34
 
INSERT INTO ogc_prep (c, g1, g2)
35
 
        VALUES ('105', ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521513 5377804)', 32631) );
36
 
INSERT INTO ogc_prep (c, g1, g2)
37
 
        VALUES ('106', ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521543 5377804)', 32631) );
38
 
INSERT INTO ogc_prep (c, g1, g2)
39
 
        VALUES ('106', ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521543 5377804)', 32631) );
40
 
INSERT INTO ogc_prep (c, g1, g2)
41
 
        VALUES ('106', ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), ST_GeomFromText('POINT(521543 5377804)', 32631) );
42
 
 
43
 
SELECT 'intersectspoly' || c, ST_Intersects(g1, g2) FROM ogc_prep WHERE c = '105';
44
 
SELECT 'intersectspoint' || c, ST_Intersects(g2, g1) FROM ogc_prep WHERE c = '105';
45
 
SELECT 'containspoly' || c, ST_Contains(g1, g2) FROM ogc_prep WHERE c = '105';
46
 
SELECT 'containspoint' || c, ST_Contains(g2, g1) FROM ogc_prep WHERE c = '105';
47
 
SELECT 'containsproperlypoly' || c, ST_ContainsProperly(g1, g2) FROM ogc_prep WHERE c = '105';
48
 
SELECT 'containsproperlypoint' || c, ST_ContainsProperly(g2, g1) FROM ogc_prep WHERE c = '105';
49
 
SELECT 'coverspoly' || c, ST_Covers(g1, g2) FROM ogc_prep WHERE c = '105';
50
 
SELECT 'coverspoint' || c, ST_Covers(g2, g1) FROM ogc_prep WHERE c = '105';
51
 
 
52
 
SELECT 'intersectspoly' || c, ST_Intersects(g1, g2) FROM ogc_prep WHERE c = '106';
53
 
SELECT 'intersectspoint' || c, ST_Intersects(g2, g1) FROM ogc_prep WHERE c = '106';
54
 
SELECT 'containspoly' || c, ST_Contains(g1, g2) FROM ogc_prep WHERE c = '106';
55
 
SELECT 'containspoint' || c, ST_Contains(g2, g1) FROM ogc_prep WHERE c = '106';
56
 
SELECT 'containsproperlypoly' || c, ST_ContainsProperly(g1, g2) FROM ogc_prep WHERE c = '106';
57
 
SELECT 'containsproperlypoint' || c, ST_ContainsProperly(g2, g1) FROM ogc_prep WHERE c = '106';
58
 
SELECT 'coverspoly' || c, ST_Covers(g1, g2) FROM ogc_prep WHERE c = '106';
59
 
SELECT 'coverspoint' || c, ST_Covers(g2, g1) FROM ogc_prep WHERE c = '106';
60
 
 
61
 
 
62
 
INSERT INTO ogc_prep (c, g1, g2)
63
 
        VALUES ('200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'); 
64
 
INSERT INTO ogc_prep (c, g1, g2)
65
 
        VALUES ('201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'); 
66
 
INSERT INTO ogc_prep (c, g1, g2)
67
 
        VALUES ('202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))');
68
 
INSERT INTO ogc_prep (c, g1, g2)
69
 
        VALUES ('203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))');
70
 
INSERT INTO ogc_prep (c, g1, g2)
71
 
        VALUES ('204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))');
72
 
INSERT INTO ogc_prep (c, g1, g2)
73
 
        VALUES ('205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'); 
74
 
INSERT INTO ogc_prep (c, g1, g2)
75
 
        VALUES ('206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'); 
76
 
INSERT INTO ogc_prep (c, g1, g2)
77
 
        VALUES ('207', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))');
78
 
INSERT INTO ogc_prep (c, g1, g2)
79
 
        VALUES ('208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))');
80
 
INSERT INTO ogc_prep (c, g1, g2)
81
 
        VALUES ('209', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))');
82
 
 
83
 
SELECT 'intersects' || c, ST_Intersects(g1, g2) AS intersects_g1g2, ST_Intersects(g2, g1) AS intersects_g2g1 
84
 
        FROM ogc_prep WHERE c >= '200' ORDER BY c;
85
 
SELECT 'contains' || c, ST_Contains(g1, g2) AS contains_g1g2, ST_Contains(g2, g1) AS contains_g2g1 
86
 
        FROM ogc_prep WHERE c >= '200' ORDER BY c;
87
 
SELECT 'containsproperly' || c, ST_ContainsProperly(g1, g2) AS containsproperly_g1g2, ST_ContainsProperly(g2, g1) AS containsproperly_g2g1 
88
 
        FROM ogc_prep WHERE c >= '200' ORDER BY c;
89
 
SELECT 'covers' || c, ST_Covers(g1, g2) AS covers_g1g2, ST_Covers(g2, g1) AS covers_g2g1 
90
 
        FROM ogc_prep WHERE c >= '200' ORDER BY c;
91
 
 
92
 
 
93
 
 
94
 
 
95
 
INSERT INTO ogc_prep (c, g1, g2)
96
 
        VALUES ('300', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)');
97
 
INSERT INTO ogc_prep (c, g1, g2)
98
 
        VALUES ('301', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'); 
99
 
INSERT INTO ogc_prep (c, g1, g2)
100
 
        VALUES ('302', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'); 
101
 
INSERT INTO ogc_prep (c, g1, g2)
102
 
        VALUES ('303', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)');
103
 
INSERT INTO ogc_prep (c, g1, g2)
104
 
        VALUES ('304', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'); 
105
 
INSERT INTO ogc_prep (c, g1, g2)
106
 
        VALUES ('305', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'); 
107
 
INSERT INTO ogc_prep (c, g1, g2)
108
 
        VALUES ('306', 'POINT(5 5)', 'POINT(5 5)');
109
 
INSERT INTO ogc_prep (c, g1, g2)
110
 
        VALUES ('307', 'POINT(5 5)', 'POINT(5 5)');
111
 
INSERT INTO ogc_prep (c, g1, g2)
112
 
        VALUES ('308', 'POINT(5 5)', 'POINT(5 5)'); 
113
 
INSERT INTO ogc_prep (c, g1, g2)
114
 
        VALUES ('309', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
115
 
INSERT INTO ogc_prep (c, g1, g2)
116
 
        VALUES ('310', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'); 
117
 
INSERT INTO ogc_prep (c, g1, g2)
118
 
        VALUES ('311', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'); 
119
 
INSERT INTO ogc_prep (c, g1, g2)
120
 
        VALUES ('312', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)');
121
 
INSERT INTO ogc_prep (c, g1, g2)
122
 
        VALUES ('313', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'); 
123
 
INSERT INTO ogc_prep (c, g1, g2)
124
 
        VALUES ('314', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)');
125
 
 
126
 
 
127
 
SELECT c, ST_Contains(g1, g2) AS contains_g1g2, ST_Contains(g2, g1) AS contains_g2g1, 
128
 
          ST_Covers(g1, g2) AS covers_g1g2, ST_Covers(g2, g1) AS covers_g2g1,
129
 
          ST_Intersects(g1, g2) AS intersects_g1g2, ST_Intersects(g2, g1) AS intersects_g2g1,
130
 
          ST_ContainsProperly(g1, g2) AS containsproper_g1g2, ST_ContainsProperly(g2, g1) AS containsproper_g2g1 
131
 
          FROM ogc_prep WHERE c >= '300' ORDER BY c;
132
 
 
133
 
INSERT INTO ogc_prep (c, g1, g2)
134
 
        VALUES ( '400', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(1 10, 9 10, 9 8)');
135
 
INSERT INTO ogc_prep (c, g1, g2)
136
 
        VALUES ( '400', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(1 10, 9 10, 9 8)');
137
 
INSERT INTO ogc_prep (c, g1, g2)
138
 
        VALUES ( '400', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(1 10, 9 10, 9 8)');
139
 
INSERT INTO ogc_prep (c, g1, g2)
140
 
        VALUES ( '401', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(1 10, 10 10, 10 8)');
141
 
INSERT INTO ogc_prep (c, g1, g2)
142
 
        VALUES ( '401', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(1 10, 10 10, 10 8)');
143
 
INSERT INTO ogc_prep (c, g1, g2)
144
 
        VALUES ( '401', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(1 10, 10 10, 10 8)');
145
 
        
146
 
SELECT 'intersects' || c, ST_Intersects(g1, g2) FROM ogc_prep WHERE c >= '400' ORDER BY c;
147
 
SELECT 'contains' || c, ST_Contains(g1, g2) FROM ogc_prep WHERE c >= '400' ORDER BY c;
148
 
SELECT 'containsproperly' || c, ST_ContainsProperly(g1, g2) FROM ogc_prep WHERE c >= '400' ORDER BY c;
149
 
SELECT 'covers' || c, ST_Covers(g1, g2) FROM ogc_prep WHERE c >= '400' ORDER BY c;
150
 
 
151
 
DROP TABLE ogc_prep;
 
6
SELECT c, ST_Intersects(ply, pt) FROM 
 
7
( VALUES 
 
8
-- PIP - point within polygon (no cache)
 
9
('intersects099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
 
10
-- PIP - point within polygon
 
11
('intersects100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
 
12
-- PIP - point on polygon vertex
 
13
('intersects101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), 
 
14
-- PIP - point outside polygon
 
15
('intersects102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'),
 
16
-- PIP - point on polygon edge
 
17
('intersects103', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 5)'),
 
18
-- PIP - point in line with polygon edge
 
19
('intersects104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)')
 
20
) AS v(c,ply,pt);
 
21
 
 
22
SELECT c, ST_Contains(ply, pt) FROM 
 
23
( VALUES 
 
24
-- PIP - point within polygon (no cache)
 
25
('contains099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
 
26
-- PIP - point within polygon
 
27
('contains100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
 
28
-- PIP - point on polygon vertex
 
29
('contains101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), 
 
30
-- PIP - point outside polygon
 
31
('contains102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'),
 
32
-- PIP - point on polygon edge
 
33
('contains103', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 5)'),
 
34
-- PIP - point in line with polygon edge
 
35
('contains104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)')
 
36
) AS v(c,ply,pt);
 
37
 
 
38
SELECT c, ST_Covers(ply, pt) FROM 
 
39
( VALUES 
 
40
-- PIP - point within polygon (no cache)
 
41
('covers099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
 
42
-- PIP - point within polygon
 
43
('covers100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
 
44
-- PIP - point on polygon vertex
 
45
('covers101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), 
 
46
-- PIP - point outside polygon
 
47
('covers102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'),
 
48
-- PIP - point on polygon edge
 
49
('covers103', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 5)'),
 
50
-- PIP - point in line with polygon edge
 
51
('covers104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)')
 
52
) AS v(c,ply,pt);
 
53
 
 
54
SELECT c, ST_ContainsProperly(ply, pt) FROM 
 
55
( VALUES 
 
56
-- PIP - point within polygon (no cache)
 
57
('containsproperly099', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
 
58
-- PIP - point within polygon
 
59
('containsproperly100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
 
60
-- PIP - point on polygon vertex
 
61
('containsproperly101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 0)'), 
 
62
-- PIP - point outside polygon
 
63
('containsproperly102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(-1 0)'),
 
64
-- PIP - point on polygon edge
 
65
('containsproperly103', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 5)'),
 
66
-- PIP - point in line with polygon edge
 
67
('containsproperly104', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(0 12)')
 
68
) AS v(c,ply,pt);
 
69
 
 
70
 
 
71
-- PIP - point vertically aligned with polygon vertex, poly first
 
72
SELECT 'intersects105', ST_Intersects(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM 
 
73
( VALUES 
 
74
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
75
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
76
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
 
77
) AS v(p);
 
78
-- PIP - point vertically aligned with polygon vertex, point first
 
79
SELECT 'intersects106', ST_Intersects(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM 
 
80
( VALUES 
 
81
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
82
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
83
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
 
84
) AS v(p);
 
85
-- PIP - repeated vertex, poly first
 
86
SELECT 'intersects107', ST_Intersects(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM 
 
87
( VALUES 
 
88
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
89
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
90
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 
91
) AS v(p);
 
92
-- PIP - repeated vertex, point first
 
93
SELECT 'intersects108', ST_Intersects(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM 
 
94
( VALUES 
 
95
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
96
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
97
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 
98
) AS v(p);
 
99
 
 
100
 
 
101
-- PIP - point vertically aligned with polygon vertex, poly first
 
102
SELECT 'contains105', ST_Contains(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM 
 
103
( VALUES 
 
104
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
105
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
106
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
 
107
) AS v(p);
 
108
-- PIP - point vertically aligned with polygon vertex, point first
 
109
SELECT 'contains106', ST_Contains(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM 
 
110
( VALUES 
 
111
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
112
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
113
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
 
114
) AS v(p);
 
115
-- PIP - repeated vertex, poly first
 
116
SELECT 'contains107', ST_Contains(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM 
 
117
( VALUES 
 
118
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
119
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
120
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 
121
) AS v(p);
 
122
-- PIP - repeated vertex, point first
 
123
SELECT 'contains108', ST_Contains(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM 
 
124
( VALUES 
 
125
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
126
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
127
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 
128
) AS v(p);
 
129
 
 
130
-- PIP - point vertically aligned with polygon vertex, poly first
 
131
SELECT 'containsproperly105', ST_ContainsProperly(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM 
 
132
( VALUES 
 
133
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
134
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
135
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
 
136
) AS v(p);
 
137
-- PIP - point vertically aligned with polygon vertex, point first
 
138
SELECT 'containsproperly106', ST_ContainsProperly(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM 
 
139
( VALUES 
 
140
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
141
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
142
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
 
143
) AS v(p);
 
144
-- PIP - repeated vertex, poly first
 
145
SELECT 'containsproperly107', ST_ContainsProperly(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM 
 
146
( VALUES 
 
147
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
148
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
149
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 
150
) AS v(p);
 
151
-- PIP - repeated vertex, point first
 
152
SELECT 'containsproperly108', ST_ContainsProperly(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM 
 
153
( VALUES 
 
154
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
155
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
156
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 
157
) AS v(p);
 
158
 
 
159
-- PIP - point vertically aligned with polygon vertex, poly first
 
160
SELECT 'covers105', ST_Covers(p, ST_GeomFromText('POINT(521513 5377804)', 32631)) FROM 
 
161
( VALUES 
 
162
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
163
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
164
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
 
165
) AS v(p);
 
166
-- PIP - point vertically aligned with polygon vertex, point first
 
167
SELECT 'covers106', ST_Covers(ST_GeomFromText('POINT(521513 5377804)', 32631), p) FROM 
 
168
( VALUES 
 
169
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
170
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
171
        (ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)) 
 
172
) AS v(p);
 
173
-- PIP - repeated vertex, poly first
 
174
SELECT 'covers107', ST_Covers(p, ST_GeomFromText('POINT(521543 5377804)', 32631)) FROM 
 
175
( VALUES 
 
176
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
177
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
178
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 
179
) AS v(p);
 
180
-- PIP - repeated vertex, point first
 
181
SELECT 'covers108', ST_Covers(ST_GeomFromText('POINT(521543 5377804)', 32631), p) FROM 
 
182
( VALUES 
 
183
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
184
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631)),
 
185
        (ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631))
 
186
) AS v(p);
 
187
 
 
188
 
 
189
SELECT c, ST_Intersects(p1, p2) AS intersects_p1p2, ST_Intersects(p2, p1) AS intersects_p2p1 FROM
 
190
( VALUES
 
191
('intersects200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
192
('intersects201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
193
('intersects202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
 
194
('intersects203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
 
195
('intersects204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'),
 
196
('intersects205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
197
('intersects206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
198
('intersects207', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
 
199
('intersects208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
 
200
('intersects209', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')
 
201
) AS v(c,p1,p2);
 
202
 
 
203
SELECT c, ST_Contains(p1, p2) AS contains_p1p2, ST_Contains(p2, p1) AS contains_p2p1 FROM
 
204
( VALUES
 
205
('contains200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
206
('contains201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
207
('contains202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
 
208
('contains203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
 
209
('contains204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'),
 
210
('contains205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
211
('contains206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
212
('contains207', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
 
213
('contains208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
 
214
('contains209', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')
 
215
) AS v(c,p1,p2);
 
216
 
 
217
SELECT c, ST_ContainsProperly(p1, p2) AS containsproperly_p1p2, ST_ContainsProperly(p2, p1) AS containsproperly_p2p1 FROM
 
218
( VALUES
 
219
('containsproperly200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
220
('containsproperly201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
221
('containsproperly202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
 
222
('containsproperly203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
 
223
('containsproperly204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'),
 
224
('containsproperly205', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
225
('containsproperly206', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
226
('containsproperly207', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
 
227
('containsproperly208', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
 
228
('containsproperly209', 'POLYGON((0 0, 0 10, 10 11, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')
 
229
) AS v(c,p1,p2);
 
230
 
 
231
SELECT c, ST_Covers(p1, p2) AS covers_p1p2, ST_Covers(p2, p1) AS covers_p2p1 FROM
 
232
( VALUES
 
233
('covers200', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
234
('covers201', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
235
('covers202', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
 
236
('covers203', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
 
237
('covers204', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))'),
 
238
('covers205', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
239
('covers206', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((2 2, 2 3, 3 3, 3 2, 2 2))'), 
 
240
('covers207', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))'),
 
241
('covers208', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((-5 -5, 5 -5, 5 5, -5 5, -5 -5))'), 
 
242
('covers209', 'POLYGON((0 0, 0 10, 10 10, 11 0, 0 0))', 'POLYGON((-2 -2, -2 -3, -3 -3, -3 -2, -2 -2))')
 
243
) AS v(c,p1,p2);
 
244
 
 
245
-- UNEXPECTED GEOMETRY TYPES --
 
246
 
 
247
SELECT c, ST_Contains(p1, p2) AS contains_p1p2, ST_Contains(p2, p1) AS contains_p2p1, 
 
248
          ST_Covers(p1, p2) AS covers_p1p2, ST_Covers(p2, p1) AS covers_p2p1,
 
249
          ST_Intersects(p1, p2) AS intersects_p1p2, ST_Intersects(p2, p1) AS intersects_p2p1,
 
250
          ST_ContainsProperly(p1, p2) AS containsproper_p1p2, ST_ContainsProperly(p2, p1) AS containsproper_p2p1 
 
251
          FROM
 
252
( VALUES
 
253
('types100', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
 
254
('types101', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
 
255
('types102', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POINT(5 5)'), 
 
256
('types103', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'), 
 
257
('types104', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'), 
 
258
('types105', 'LINESTRING(0 0, 0 10, 10 10, 10 0)', 'POINT(5 5)'), 
 
259
('types106', 'POINT(5 5)', 'POINT(5 5)'), 
 
260
('types107', 'POINT(5 5)', 'POINT(5 5)'), 
 
261
('types108', 'POINT(5 5)', 'POINT(5 5)'), 
 
262
('types109', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), 
 
263
('types110', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), 
 
264
('types111', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'), 
 
265
('types112', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'), 
 
266
('types113', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)'), 
 
267
('types114', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 'LINESTRING(0 0, 0 10, 10 10, 10 0)') 
 
268
) AS v(c,p1,p2);
 
269
 
 
270
 
 
271
SELECT 'intersects310', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
 
272
('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 
273
) AS v(p);
 
274
SELECT 'intersects311', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
 
275
('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 
276
) AS v(p);
 
277
 
 
278
SELECT 'contains310', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
 
279
('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 
280
) AS v(p);
 
281
SELECT 'contains311', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
 
282
('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 
283
) AS v(p);
 
284
 
 
285
SELECT 'containsproperly310', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
 
286
('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 
287
) AS v(p);
 
288
SELECT 'containsproperly311', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
 
289
('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 
290
) AS v(p);
 
291
 
 
292
SELECT 'covers310', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
 
293
('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 
294
) AS v(p);
 
295
SELECT 'covers311', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) FROM ( VALUES 
 
296
('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 
297
) AS v(p);
 
298