File: predicates.sql.in

package info (click to toggle)
postgis 2.5.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 75,792 kB
  • sloc: ansic: 139,314; sql: 136,281; xml: 48,954; sh: 4,906; perl: 4,509; makefile: 2,897; python: 1,198; yacc: 441; cpp: 305; lex: 132
file content (130 lines) | stat: -rw-r--r-- 3,438 bytes parent folder | download
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
-- This scripts add some features to the ones defined by load_topology.sql
-- and then runs some binary predicates on them.
--

#define DO_POINT_POINT_INTERSECTS 1
#define DO_POINT_LINE_INTERSECTS 1
#define DO_LINE_LINE_INTERSECTS 1
#define DO_POINT_POLYGON_INTERSECTS 1
#define DO_LINE_POLYGON_INTERSECTS 1
#define DO_POLYGON_POLYGON_INTERSECTS 1
#define DO_POINT_POINT_EQUALS 1
#define DO_LINE_LINE_EQUALS 1
#define DO_POLYGON_POLYGON_EQUALS 1

BEGIN;

#if DO_POINT_POINT_INTERSECTS

-- Detect intersections between traffic_signs

SELECT 'POINT/POINT INTERSECTS' as operation;

SELECT a.feature_name, b.feature_name FROM
	features.traffic_signs a, features.traffic_signs b
	WHERE a.oid < b.oid AND @SCHEMA@intersects(a.@COLUMN@, b.@COLUMN@);

#endif

#if DO_POINT_LINE_INTERSECTS

-- Detect intersections between city_streets and traffic_signs

SELECT 'POINT/LINE INTERSECTS' as operation;

SELECT a.feature_name, b.feature_name FROM
	features.traffic_signs a, features.city_streets b
	WHERE @SCHEMA@intersects(a.@COLUMN@, b.@COLUMN@);

#endif

#if DO_LINE_LINE_INTERSECTS

-- Detect intersections between city_streets

SELECT 'LINE/LINE INTERSECTS' as operation;

SELECT a.feature_name, b.feature_name FROM
	features.city_streets a, features.city_streets b
	WHERE a.oid < b.oid AND @SCHEMA@intersects(a.@COLUMN@, b.@COLUMN@);
#endif

#if DO_POINT_POLYGON_INTERSECTS

-- Detect intersections between traffic_signs and land_parcels

SELECT 'POINT/POLY INTERSECTS' as operation;

SELECT a.feature_name, b.feature_name FROM
	features.traffic_signs a, features.land_parcels b
	WHERE @SCHEMA@intersects(a.@COLUMN@, b.@COLUMN@);
#endif

#if DO_LINE_POLYGON_INTERSECTS

-- Detect intersections between city_streets and land_parcels

SELECT 'LINE/POLY INTERSECTS' as operation;

SELECT a.feature_name, b.feature_name FROM
	features.city_streets a, features.land_parcels b
	WHERE @SCHEMA@intersects(a.@COLUMN@, b.@COLUMN@);
#endif

#if DO_POLYGON_POLYGON_INTERSECTS

-- Detect intersections between land_parcels and land_parcels

SELECT 'POLY/POLY INTERSECTS' as operation;

SELECT a.feature_name, b.feature_name FROM
	features.land_parcels a, features.land_parcels b
	WHERE a.oid < b.oid AND @SCHEMA@intersects(a.@COLUMN@, b.@COLUMN@);
#endif

#if DO_POINT_POINT_EQUALS

SELECT 'POINT/POINT EQUALS' as operation;

SELECT a.feature_name, b.feature_name FROM
	features.traffic_signs a, features.traffic_signs b
	WHERE a.oid < b.oid AND @SCHEMA@equals(a.@COLUMN@, b.@COLUMN@);

#endif

#if DO_LINE_LINE_EQUALS

SELECT 'LINE/LINE EQUALS' as operation;

SELECT a.feature_name, b.feature_name FROM
	features.city_streets a, features.city_streets b
	WHERE a.oid < b.oid AND @SCHEMA@equals(a.@COLUMN@, b.@COLUMN@);

#endif

#if DO_POLYGON_POLYGON_EQUALS

SELECT 'POLYGON/POLYGON EQUALS' as operation;

SELECT a.feature_name, b.feature_name FROM
	features.land_parcels a, features.land_parcels b
	WHERE a.oid < b.oid AND @SCHEMA@equals(a.@COLUMN@, b.@COLUMN@);

#endif

SELECT 'POINT/POINT EQUALS (simple/hierarchical)' as operation;

SELECT a.feature_name, b.feature_name
	FROM features.traffic_signs a, features.big_signs b
	WHERE a.oid < b.oid AND @SCHEMA@equals(a.feature, b.feature)
	ORDER BY a.oid;

SELECT 'POLYGON/POLYGON EQUALS (simple/hierarchical)' as operation;

SELECT a.feature_name, b.feature_name
	FROM features.land_parcels a, features.big_parcels b
	WHERE a.oid < b.oid AND @SCHEMA@equals(a.feature, b.feature)
	ORDER BY a.oid;

END;