forked from postgis/postgis
/
sql-mm-compoundcurve.sql
324 lines (295 loc) · 23.5 KB
/
sql-mm-compoundcurve.sql
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
SELECT 'ndims01', ST_NDims(ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
0 0 0 0,
0.26794919243112270647255365849413 1 3 -2,
0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2,
2 0 0 0,
0 0 0 0))'));
SELECT 'geometrytype01', geometrytype(ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
0 0 0 0,
0.26794919243112270647255365849413 1 3 -2,
0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2,
2 0 0 0,
0 0 0 0))'));
SELECT 'ndims02', ST_NDims(ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
0 0 0,
0.26794919243112270647255365849413 1 3,
0.5857864376269049511983112757903 1.4142135623730950488016887242097 1),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097 1,
2 0 0,
0 0 0))'));
SELECT 'geometrytype02', geometrytype(ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
0 0 0,
0.26794919243112270647255365849413 1 3,
0.5857864376269049511983112757903 1.4142135623730950488016887242097 1),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097 1,
2 0 0,
0 0 0))'));
SELECT 'ndims03', ST_NDims(ST_Geomfromewkt('COMPOUNDCURVEM(CIRCULARSTRING(
0 0 0,
0.26794919243112270647255365849413 1 -2,
0.5857864376269049511983112757903 1.4142135623730950488016887242097 2),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097 2,
2 0 0,
0 0 0))'));
SELECT 'geometrytype03', geometrytype(ST_Geomfromewkt('COMPOUNDCURVEM(CIRCULARSTRING(
0 0 0,
0.26794919243112270647255365849413 1 -2,
0.5857864376269049511983112757903 1.4142135623730950488016887242097 2),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097 2,
2 0 0,
0 0 0))'));
SELECT 'ndims04', ST_NDims(ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
0 0,
0.26794919243112270647255365849413 1,
0.5857864376269049511983112757903 1.4142135623730950488016887242097),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097,
2 0,
0 0))'));
SELECT 'geometrytype04', geometrytype(ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
0 0,
0.26794919243112270647255365849413 1,
0.5857864376269049511983112757903 1.4142135623730950488016887242097),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097,
2 0,
0 0))'));
-- Repeat tests with new function names.
SELECT 'ndims01', ST_NDims(ST_geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
0 0 0 0,
0.26794919243112270647255365849413 1 3 -2,
0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2,
2 0 0 0,
0 0 0 0))'));
SELECT 'geometrytype01', geometrytype(ST_geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
0 0 0 0,
0.26794919243112270647255365849413 1 3 -2,
0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2,
2 0 0 0,
0 0 0 0))'));
SELECT 'ndims02', ST_NDims(ST_geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
0 0 0,
0.26794919243112270647255365849413 1 3,
0.5857864376269049511983112757903 1.4142135623730950488016887242097 1),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097 1,
2 0 0,
0 0 0))'));
SELECT 'geometrytype02', geometrytype(ST_geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
0 0 0,
0.26794919243112270647255365849413 1 3,
0.5857864376269049511983112757903 1.4142135623730950488016887242097 1),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097 1,
2 0 0,
0 0 0))'));
SELECT 'ndims03', ST_NDims(ST_geomfromewkt('COMPOUNDCURVEM(CIRCULARSTRING(
0 0 0,
0.26794919243112270647255365849413 1 -2,
0.5857864376269049511983112757903 1.4142135623730950488016887242097 2),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097 2,
2 0 0,
0 0 0))'));
SELECT 'geometrytype03', geometrytype(ST_geomfromewkt('COMPOUNDCURVEM(CIRCULARSTRING(
0 0 0,
0.26794919243112270647255365849413 1 -2,
0.5857864376269049511983112757903 1.4142135623730950488016887242097 2),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097 2,
2 0 0,
0 0 0))'));
SELECT 'ndims04', ST_NDims(ST_geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
0 0,
0.26794919243112270647255365849413 1,
0.5857864376269049511983112757903 1.4142135623730950488016887242097),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097,
2 0,
0 0))'));
SELECT 'geometrytype04', geometrytype(ST_geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
0 0,
0.26794919243112270647255365849413 1,
0.5857864376269049511983112757903 1.4142135623730950488016887242097),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097,
2 0,
0 0))'));
CREATE TABLE public.compoundcurve (id INTEGER, description VARCHAR,
the_geom_2d GEOMETRY(COMPOUNDCURVE),
the_geom_3dm GEOMETRY(COMPOUNDCURVEM),
the_geom_3dz GEOMETRY(COMPOUNDCURVEZ),
the_geom_4d GEOMETRY(COMPOUNDCURVEZM)
);
INSERT INTO public.compoundcurve (
id,
description
) VALUES (
2,
'compoundcurve');
UPDATE public.compoundcurve
SET the_geom_4d = ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
0 0 0 0,
0.26794919243112270647255365849413 1 3 -2,
0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097 1 2,
2 0 0 0,
0 0 0 0))');
UPDATE public.compoundcurve
SET the_geom_3dz = ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
0 0 0,
0.26794919243112270647255365849413 1 3,
0.5857864376269049511983112757903 1.4142135623730950488016887242097 1),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097 1,
2 0 0,
0 0 0))');
UPDATE public.compoundcurve
SET the_geom_3dm = ST_Geomfromewkt('COMPOUNDCURVEM(CIRCULARSTRING(
0 0 0,
0.26794919243112270647255365849413 1 -2,
0.5857864376269049511983112757903 1.4142135623730950488016887242097 2),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097 2,
2 0 0,
0 0 0))');
UPDATE public.compoundcurve
SET the_geom_2d = ST_Geomfromewkt('COMPOUNDCURVE(CIRCULARSTRING(
0 0,
0.26794919243112270647255365849413 1,
0.5857864376269049511983112757903 1.4142135623730950488016887242097),
(0.5857864376269049511983112757903 1.4142135623730950488016887242097,
2 0,
0 0))');
SELECT 'astext01', ST_Astext(the_geom_2d) FROM public.compoundcurve;
SELECT 'astext02', ST_Astext(the_geom_3dm) FROM public.compoundcurve;
SELECT 'astext03', ST_Astext(the_geom_3dz) FROM public.compoundcurve;
SELECT 'astext04', ST_Astext(the_geom_4d) FROM public.compoundcurve;
SELECT 'asewkt01', ST_Asewkt(the_geom_2d) FROM public.compoundcurve;
SELECT 'asewkt02', ST_Asewkt(the_geom_3dm) FROM public.compoundcurve;
SELECT 'asewkt03', ST_Asewkt(the_geom_3dz) FROM public.compoundcurve;
SELECT 'asewkt04', ST_Asewkt(the_geom_4d) FROM public.compoundcurve;
-- These tests will fail on different architectures
-- We need a way to handle multiple byte orderings
--SELECT 'asbinary01', encode(asbinary(the_geom_2d), 'hex') FROM public.compoundcurve;
--SELECT 'asbinary02', encode(asbinary(the_geom_3dm), 'hex') FROM public.compoundcurve;
--SELECT 'asbinary03', encode(asbinary(the_geom_3dz), 'hex') FROM public.compoundcurve;
--SELECT 'asbinary04', encode(asbinary(the_geom_4d), 'hex') FROM public.compoundcurve;
--
--SELECT 'asewkb01', encode(asewkb(the_geom_2d), 'hex') FROM public.compoundcurve;
--SELECT 'asewkb02', encode(asewkb(the_geom_3dm), 'hex') FROM public.compoundcurve;
--SELECT 'asewkb03', encode(asewkb(the_geom_3dz), 'hex') FROM public.compoundcurve;
--SELECT 'asewkb04', encode(asewkb(the_geom_4d), 'hex') FROM public.compoundcurve;
SELECT 'ST_CurveToLine-201', ST_Asewkt(ST_SnapToGrid(ST_CurveToLine(the_geom_2d, 2), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
SELECT 'ST_CurveToLine-202', ST_Asewkt(ST_SnapToGrid(ST_CurveToLine(the_geom_3dm, 2), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
SELECT 'ST_CurveToLine-203', ST_Asewkt(ST_SnapToGrid(ST_CurveToLine(the_geom_3dz, 2), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
SELECT 'ST_CurveToLine-204', ST_Asewkt(ST_SnapToGrid(ST_CurveToLine(the_geom_4d, 2), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
SELECT 'ST_CurveToLine-401', ST_Asewkt(ST_SnapToGrid(ST_CurveToLine(the_geom_2d, 4), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
SELECT 'ST_CurveToLine-402', ST_Asewkt(ST_SnapToGrid(ST_CurveToLine(the_geom_3dm, 4), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
SELECT 'ST_CurveToLine-403', ST_Asewkt(ST_SnapToGrid(ST_CurveToLine(the_geom_3dz, 4), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
SELECT 'ST_CurveToLine-404', ST_Asewkt(ST_SnapToGrid(ST_CurveToLine(the_geom_4d, 4), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
SELECT 'ST_CurveToLine01', ST_Asewkt(ST_SnapToGrid(ST_CurveToLine(the_geom_2d), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
SELECT 'ST_CurveToLine02', ST_Asewkt(ST_SnapToGrid(ST_CurveToLine(the_geom_3dm), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
SELECT 'ST_CurveToLine03', ST_Asewkt(ST_SnapToGrid(ST_CurveToLine(the_geom_3dz), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
SELECT 'ST_CurveToLine04', ST_Asewkt(ST_SnapToGrid(ST_CurveToLine(the_geom_4d), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
-- Removed due to discrepencies between hardware
--SELECT 'box2d01', box2d(the_geom_2d) FROM public.compoundcurve;
--SELECT 'box2d02', box2d(the_geom_3dm) FROM public.compoundcurve;
--SELECT 'box2d03', box2d(the_geom_3dz) FROM public.compoundcurve;
--SELECT 'box2d04', box2d(the_geom_4d) FROM public.compoundcurve;
--SELECT 'box3d01', box3d(the_geom_2d) FROM public.compoundcurve;
--SELECT 'box3d02', box3d(the_geom_3dm) FROM public.compoundcurve;
--SELECT 'box3d03', box3d(the_geom_3dz) FROM public.compoundcurve;
--SELECT 'box3d04', box3d(the_geom_4d) FROM public.compoundcurve;
-- SELECT 'isValid01', isValid(the_geom_2d) FROM public.compoundcurve;
-- SELECT 'isValid02', isValid(the_geom_3dm) FROM public.compoundcurve;
-- SELECT 'isValid03', isValid(the_geom_3dz) FROM public.compoundcurve;
-- SELECT 'isValid04', isValid(the_geom_4d) FROM public.compoundcurve;
-- SELECT 'dimension01', dimension(the_geom_2d) FROM public.compoundcurve;
-- SELECT 'dimension02', dimension(the_geom_3dm) FROM public.compoundcurve;
-- SELECT 'dimension03', dimension(the_geom_3dz) FROM public.compoundcurve;
-- SELECT 'dimension04', dimension(the_geom_4d) FROM public.compoundcurve;
-- SELECT 'SRID01', ST_SRID(the_geom_2d) FROM public.compoundcurve;
-- SELECT 'SRID02', ST_SRID(the_geom_3dm) FROM public.compoundcurve;
-- SELECT 'SRID03', ST_SRID(the_geom_3dz) FROM public.compoundcurve;
-- SELECT 'SRID04', ST_SRID(the_geom_4d) FROM public.compoundcurve;
-- SELECT 'accessor01', isEmpty(the_geom_2d), isSimple(the_geom_2d), isClosed(the_geom_2d), isRing(the_geom_2d) FROM public.compoundcurve;
-- SELECT 'accessor02', isEmpty(the_geom_3dm), isSimple(the_geom_3dm), isClosed(the_geom_3dm), isRing(the_geom_3dm) FROM public.compoundcurve;
-- SELECT 'accessor03', isEmpty(the_geom_3dz), isSimple(the_geom_3dz), isClosed(the_geom_3dz), isRing(the_geom_3dz) FROM public.compoundcurve;
-- SELECT 'accessor04', isEmpty(the_geom_4d), isSimple(the_geom_4d), isClosed(the_geom_4d), isRing(the_geom_4d) FROM public.compoundcurve;
-- SELECT 'envelope01', ST_AsText(ST_SnapToGrid(envelope(the_geom_2d), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
-- SELECT 'envelope02', ST_AsText(ST_SnapToGrid(envelope(the_geom_3dm), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
-- SELECT 'envelope03', ST_AsText(ST_SnapToGrid(envelope(the_geom_3dz), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
-- SELECT 'envelope04', ST_AsText(ST_SnapToGrid(envelope(the_geom_4d), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
-- TODO: ST_SnapToGrid is required to remove platform dependent precision
-- issues. Until ST_SnapToGrid is updated to work against curves, these
-- tests cannot be run.
--SELECT 'ST_LineToCurve', ST_Asewkt(ST_LineToCurve(ST_CurveToLine(the_geom_2d))) FROM public.compoundcurve;
--SELECT 'ST_LineToCurve', ST_Asewkt(ST_LineToCurve(ST_CurveToLine(the_geom_3dm))) FROM public.compoundcurve;
--SELECT 'ST_LineToCurve', ST_Asewkt(ST_LineToCurve(ST_CurveToLine(the_geom_3dz))) FROM public.compoundcurve;
--SELECT 'ST_LineToCurve', ST_Asewkt(ST_LineToCurve(ST_CurveToLine(the_geom_4d))) FROM public.compoundcurve;
-- Repeat tests on new function names.
SELECT 'astext01', ST_astext(the_geom_2d) FROM public.compoundcurve;
SELECT 'astext02', ST_astext(the_geom_3dm) FROM public.compoundcurve;
SELECT 'astext03', ST_astext(the_geom_3dz) FROM public.compoundcurve;
SELECT 'astext04', ST_astext(the_geom_4d) FROM public.compoundcurve;
SELECT 'asewkt01', ST_asewkt(the_geom_2d) FROM public.compoundcurve;
SELECT 'asewkt02', ST_asewkt(the_geom_3dm) FROM public.compoundcurve;
SELECT 'asewkt03', ST_asewkt(the_geom_3dz) FROM public.compoundcurve;
SELECT 'asewkt04', ST_asewkt(the_geom_4d) FROM public.compoundcurve;
--SELECT 'asbinary01', encode(ST_asbinary(the_geom_2d), 'hex') FROM public.compoundcurve;
--SELECT 'asbinary02', encode(ST_asbinary(the_geom_3dm), 'hex') FROM public.compoundcurve;
--SELECT 'asbinary03', encode(ST_asbinary(the_geom_3dz), 'hex') FROM public.compoundcurve;
--SELECT 'asbinary04', encode(ST_asbinary(the_geom_4d), 'hex') FROM public.compoundcurve;
--
--SELECT 'asewkb01', encode(ST_asewkb(the_geom_2d), 'hex') FROM public.compoundcurve;
--SELECT 'asewkb02', encode(ST_asewkb(the_geom_3dm), 'hex') FROM public.compoundcurve;
--SELECT 'asewkb03', encode(ST_asewkb(the_geom_3dz), 'hex') FROM public.compoundcurve;
--SELECT 'asewkb04', encode(ST_asewkb(the_geom_4d), 'hex') FROM public.compoundcurve;
-- Removed due to discrepencies between hardware
--SELECT 'box2d01', ST_box2d(the_geom_2d) FROM public.compoundcurve;
--SELECT 'box2d02', ST_box2d(the_geom_3dm) FROM public.compoundcurve;
--SELECT 'box2d03', ST_box2d(the_geom_3dz) FROM public.compoundcurve;
--SELECT 'box2d04', ST_box2d(the_geom_4d) FROM public.compoundcurve;
--SELECT 'box3d01', ST_box3d(the_geom_2d) FROM public.compoundcurve;
--SELECT 'box3d02', ST_box3d(the_geom_3dm) FROM public.compoundcurve;
--SELECT 'box3d03', ST_box3d(the_geom_3dz) FROM public.compoundcurve;
--SELECT 'box3d04', ST_box3d(the_geom_4d) FROM public.compoundcurve;
SELECT 'isValid01', ST_isValid(the_geom_2d) FROM public.compoundcurve;
SELECT 'isValid02', ST_isValid(the_geom_3dm) FROM public.compoundcurve;
SELECT 'isValid03', ST_isValid(the_geom_3dz) FROM public.compoundcurve;
SELECT 'isValid04', ST_isValid(the_geom_4d) FROM public.compoundcurve;
SELECT 'dimension01', ST_dimension(the_geom_2d) FROM public.compoundcurve;
SELECT 'dimension02', ST_dimension(the_geom_3dm) FROM public.compoundcurve;
SELECT 'dimension03', ST_dimension(the_geom_3dz) FROM public.compoundcurve;
SELECT 'dimension04', ST_dimension(the_geom_4d) FROM public.compoundcurve;
SELECT 'SRID01', ST_SRID(the_geom_2d) FROM public.compoundcurve;
SELECT 'SRID02', ST_SRID(the_geom_3dm) FROM public.compoundcurve;
SELECT 'SRID03', ST_SRID(the_geom_3dz) FROM public.compoundcurve;
SELECT 'SRID04', ST_SRID(the_geom_4d) FROM public.compoundcurve;
SELECT 'accessor01', ST_isEmpty(the_geom_2d), ST_isSimple(the_geom_2d), ST_isClosed(the_geom_2d), ST_isRing(the_geom_2d) FROM public.compoundcurve;
SELECT 'accessor02', ST_isEmpty(the_geom_3dm), ST_isSimple(the_geom_3dm), ST_isClosed(the_geom_3dm), ST_isRing(the_geom_3dm) FROM public.compoundcurve;
SELECT 'accessor03', ST_isEmpty(the_geom_3dz), ST_isSimple(the_geom_3dz), ST_isClosed(the_geom_3dz), ST_isRing(the_geom_3dz) FROM public.compoundcurve;
SELECT 'accessor04', ST_isEmpty(the_geom_4d), ST_isSimple(the_geom_4d), ST_isClosed(the_geom_4d), ST_isRing(the_geom_4d) FROM public.compoundcurve;
SELECT 'envelope01', ST_asText(ST_snapToGrid(ST_envelope(the_geom_2d), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
SELECT 'envelope02', ST_asText(ST_snapToGrid(ST_envelope(the_geom_3dm), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
SELECT 'envelope03', ST_asText(ST_snapToGrid(ST_envelope(the_geom_3dz), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
SELECT 'envelope04', ST_asText(ST_snapToGrid(ST_envelope(the_geom_4d), 'POINT(0 0 0 0)'::geometry, 1e-8, 1e-8, 1e-8, 1e-8)) FROM public.compoundcurve;
SELECT DropGeometryColumn('public', 'compoundcurve', 'the_geom_4d');
SELECT DropGeometryColumn('public', 'compoundcurve', 'the_geom_3dz');
SELECT DropGeometryColumn('public', 'compoundcurve', 'the_geom_3dm');
SELECT DropGeometryColumn('public', 'compoundcurve', 'the_geom_2d');
DROP TABLE public.compoundcurve;
SELECT 'valid wkt compound curve 1', ST_GeomFromEWKT('COMPOUNDCURVE((153.72942375 -27.21757040, 152.29285719 -29.23940482, 154.74034096 -30.51635287),(154.74034096 -30.51635287, 152.39926953 -32.16574411, 155.11278414 -34.08116619, 151.86720784 -35.62414508))');
SELECT 'valid wkt compound curve 2', ST_GeomFromEWKT('COMPOUNDCURVE((153.72942375 -27.21757040, 152.29285719 -29.23940482, 154.74034096 -30.51635287, 152.39926953 -32.16574411, 155.11278414 -34.08116619, 151.86720784 -35.62414508))');
SELECT 'valid wkt compound curve 3', ST_GeomFromEWKT('COMPOUNDCURVE((151.60117699 -27.32398274, 151.22873381 -35.94338210, 150.74987829 -27.80283826))');
SELECT 'valid wkt compound curve 4', ST_GeomFromEWKT('COMPOUNDCURVE((153.72942375 -27.21757040, 152.29285719 -29.23940482, 154.74034096 -30.51635287),CIRCULARSTRING(154.74034096 -30.51635287, 154.74034096 -30.51635287, 152.39926953 -32.16574411, 155.11278414 -34.08116619, 151.86720784 -35.62414508))');
SELECT 'valid wkt compound curve 5', ST_GeomFromEWKT('COMPOUNDCURVE(CIRCULARSTRING(157.87950492 -27.59001358, 156.01728901 -28.28169378, 155.59163966 -26.52589021),(155.59163966 -26.52589021, 153.72942375 -27.21757040, 152.29285719 -29.23940482, 154.74034096 -30.51635287),CIRCULARSTRING(154.74034096 -30.51635287, 154.74034096 -30.51635287, 152.39926953 -32.16574411, 155.11278414 -34.08116619, 151.86720784 -35.62414508))');
SELECT 'invalid wkt compound curve 1', ST_GeomFromEWKT('COMPOUNDCURVE((153.72942375 -27.21757040, 152.29285719 -29.23940482, 154.74034096 -30.51635287),(152.39926953 -32.16574411, 155.11278414 -34.08116619, 151.86720784 -35.62414508))');
SELECT 'invalid wkt compound curve 2', ST_GeomFromEWKT('COMPOUNDCURVE((153.72942375 -27.21757040, 152.29285719 -29.23940482),CIRCULARSTRING(154.74034096 -30.51635287, 154.74034096 -30.51635287, 152.39926953 -32.16574411, 155.11278414 -34.08116619, 151.86720784 -35.62414508))');
SELECT 'invalid wkt compound curve 3', ST_GeomFromEWKT('COMPOUNDCURVE(CIRCULARSTRING(157.87950492 -27.59001358, 156.01728901 -28.28169378, 155.59163966 -26.52589021, 153.72942375 -27.21757040),(153.72942375 -27.21757040, 152.29285719 -29.23940482),CIRCULARSTRING(154.74034096 -30.51635287, 154.74034096 -30.51635287, 152.39926953 -32.16574411, 155.11278414 -34.08116619, 151.86720784 -35.62414508))');
SELECT 'valid wkb compound curve 1', ST_asEWKT(ST_GeomFromEWKB(decode('0109000000020000000102000000030000009FE5797057376340E09398B1B2373BC05AAE0A165F0963409F6760A2493D3DC0DB6286DFB057634082D8A1B32F843EC0010200000004000000DB6286DFB057634082D8A1B32F843EC075B4E4D0C60C634031FA5D1A371540C0D7197CED9B636340A3CB59A7630A41C050F4A72AC0FB6240974769FCE3CF41C0', 'hex')));
SELECT 'valid wkb compound curve 2', ST_asEWKT(ST_GeomFromEWKB(decode('0109000000010000000102000000060000009FE5797057376340E09398B1B2373BC05AAE0A165F0963409F6760A2493D3DC0DB6286DFB057634082D8A1B32F843EC075B4E4D0C60C634031FA5D1A371540C0D7197CED9B636340A3CB59A7630A41C050F4A72AC0FB6240974769FCE3CF41C0', 'hex')));
SELECT 'valid wkb compound curve 3', ST_asEWKT(ST_GeomFromEWKB(decode('0109000000010000000102000000030000000CE586D73CF36240BBC46888F0523BC0102E91C951E76240DF90A1BEC0F841C0F970C100FFD7624074ADE6CE86CD3BC0', 'hex')));
SELECT 'valid wkb compound curve 4', ST_asEWKT(ST_GeomFromEWKB(decode('0109000000020000000102000000030000009FE5797057376340E09398B1B2373BC05AAE0A165F0963409F6760A2493D3DC0DB6286DFB057634082D8A1B32F843EC0010800000005000000DB6286DFB057634082D8A1B32F843EC0DB6286DFB057634082D8A1B32F843EC075B4E4D0C60C634031FA5D1A371540C0D7197CED9B636340A3CB59A7630A41C050F4A72AC0FB6240974769FCE3CF41C0', 'hex')));
SELECT 'valid wkb compound curve 5', ST_asEWKT(ST_GeomFromEWKB(decode('010900000003000000010800000003000000468280E724BC6340BF4B46210B973BC0F890AEA18D8063402D9664151D483CC0EED64BB6EE726340903CA5BDA0863AC0010200000004000000EED64BB6EE726340903CA5BDA0863AC09FE5797057376340E09398B1B2373BC05AAE0A165F0963409F6760A2493D3DC0DB6286DFB057634082D8A1B32F843EC0010800000005000000DB6286DFB057634082D8A1B32F843EC0DB6286DFB057634082D8A1B32F843EC075B4E4D0C60C634031FA5D1A371540C0D7197CED9B636340A3CB59A7630A41C050F4A72AC0FB6240974769FCE3CF41C0', 'hex')));
SELECT 'null response', ST_NumPoints(ST_GeomFromEWKT('COMPOUNDCURVE(CIRCULARSTRING(0 0,2 0, 2 1, 2 3, 4 3),(4 3, 4 5, 1 4, 0 0))'));
SELECT 'minpoints issues - pass', ST_GeomFromText('COMPOUNDCURVE((0 0,1 1))');
SELECT 'minpoints issues - pass', ST_GeomFromText('COMPOUNDCURVE(CIRCULARSTRING(0 0,0 1,1 1))');
SELECT 'minpoints issues - fail', ST_GeomFromText('COMPOUNDCURVE(CIRCULARSTRING(0 0,1 1))');
SELECT 'minpoints issues - fail', ST_GeomFromText('COMPOUNDCURVE(CIRCULARSTRING(0 0))');
SELECT 'minpoints issues - fail', ST_GeomFromText('COMPOUNDCURVE((0 0),(0 0,1 1))');