File: precise.result

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (490 lines) | stat: -rw-r--r-- 25,951 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
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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
DROP TABLE IF EXISTS t1;
select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'), ST_GeomFromText('POLYGON((10 10,30 10,30 30,10 30,10 10))'));
1	ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'), ST_GeomFromText('POLYGON((10 10,30 10,30 30,10 30,10 10))'))
1	1
select 0, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 40, 40 50, 20 70, 10 40))'));
0	ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 40, 40 50, 20 70, 10 40))'))
0	0
select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POINT(10 10)'));
1	ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POINT(10 10)'))
1	1
select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'));
1	ST_Intersects(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'))
1	1
select 0, ST_Within(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'));
0	ST_Within(ST_GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'))
0	0
select 1, ST_Within(ST_GeomFromText('POLYGON((1 1,20 10,10 30, 1 1))'), ST_GeomFromText('POLYGON((0 0,30 5,10 40, 0 0))'));
1	ST_Within(ST_GeomFromText('POLYGON((1 1,20 10,10 30, 1 1))'), ST_GeomFromText('POLYGON((0 0,30 5,10 40, 0 0))'))
1	1
create table t1 (g point)engine=innodb;
insert into t1 values
(ST_GeomFromText('POINT(2 2)')), (ST_GeomFromText('POINT(2 4)')), (ST_GeomFromText('POINT(2 6)')), (ST_GeomFromText('POINT(2 8)')),
(ST_GeomFromText('POINT(4 2)')), (ST_GeomFromText('POINT(4 4)')), (ST_GeomFromText('POINT(4 6)')), (ST_GeomFromText('POINT(4 8)')),
(ST_GeomFromText('POINT(6 2)')), (ST_GeomFromText('POINT(6 4)')), (ST_GeomFromText('POINT(6 6)')), (ST_GeomFromText('POINT(6 8)')),
(ST_GeomFromText('POINT(8 2)')), (ST_GeomFromText('POINT(8 4)')), (ST_GeomFromText('POINT(8 6)')), (ST_GeomFromText('POINT(8 8)'));
select ST_astext(g) from t1 where ST_Within(g, ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'));
ST_astext(g)
POINT(4 4)
POINT(6 2)
POINT(6 4)
POINT(6 6)
select 'Contains';
Contains
Contains
select ST_astext(g) from t1 where ST_Contains(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g);
ST_astext(g)
POINT(4 4)
POINT(6 2)
POINT(6 4)
POINT(6 6)
select 'Intersects';
Intersects
Intersects
select ST_astext(g) from t1 where ST_Intersects(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g);
ST_astext(g)
POINT(4 4)
POINT(6 2)
POINT(6 4)
POINT(6 6)
select 'Contains';
Contains
Contains
select ST_astext(g) from t1 where ST_Contains(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g);
ST_astext(g)
POINT(4 4)
POINT(6 2)
POINT(6 4)
POINT(6 6)
select 'Contains2';
Contains2
Contains2
select ST_astext(g) from t1 where ST_Contains(ST_GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1), (5.01 3.01, 6 5, 9 5, 8 3, 5.01 3.01))'), g);
ST_astext(g)
POINT(4 4)
POINT(6 2)
POINT(6 6)
DROP TABLE t1;
select 0, ST_Within(ST_GeomFromText('LINESTRING(15 15, 50 50, 60 60)'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'));
0	ST_Within(ST_GeomFromText('LINESTRING(15 15, 50 50, 60 60)'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'))
0	0
select 1, ST_Within(ST_GeomFromText('LINESTRING(15 15, 16 16)'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'));
1	ST_Within(ST_GeomFromText('LINESTRING(15 15, 16 16)'), ST_GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'))
1	1
select 1, ST_Intersects(ST_GeomFromText('LINESTRING(15 15, 50 50)'), ST_GeomFromText('LINESTRING(50 15, 15 50)'));
1	ST_Intersects(ST_GeomFromText('LINESTRING(15 15, 50 50)'), ST_GeomFromText('LINESTRING(50 15, 15 50)'))
1	1
select 1, ST_Intersects(ST_GeomFromText('LINESTRING(15 15, 50 50)'), ST_GeomFromText('LINESTRING(16 16, 51 51)'));
1	ST_Intersects(ST_GeomFromText('LINESTRING(15 15, 50 50)'), ST_GeomFromText('LINESTRING(16 16, 51 51)'))
1	1
select 1, ST_Intersects(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'));
1	ST_Intersects(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'))
1	1
select ST_astext(ST_Union(ST_geometryfromtext('point(1 1)'), ST_geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))')));
ST_astext(ST_Union(ST_geometryfromtext('point(1 1)'), ST_geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))')))
POLYGON((0 0,2 0,1 2,0 0))
select ST_astext(ST_Intersection(ST_geometryfromtext('point(1 1)'), ST_geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))')));
ST_astext(ST_Intersection(ST_geometryfromtext('point(1 1)'), ST_geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))')))
POINT(1 1)
select ST_Intersects(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'));
ST_Intersects(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'))
1
select ST_contains(ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)), ((6 6, 6 11, 11 11, 11 6, 6 6)))'), ST_GeomFromText('POINT(5 10)'));
ST_contains(ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)), ((6 6, 6 11, 11 11, 11 6, 6 6)))'), ST_GeomFromText('POINT(5 10)'))
0
select ST_Disjoint(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 15, 15 15, 15 10, 10 10))'));
ST_Disjoint(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 15, 15 15, 15 10, 10 10))'))
1
select ST_Disjoint(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))'));
ST_Disjoint(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))'))
0
select ST_Overlaps(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))'));
ST_Overlaps(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))'))
1
select ST_Overlaps(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))'));
ST_Overlaps(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), ST_GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))'))
0
select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))'));
ST_DISTANCE(ST_geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))'))
0.7071067811865476
select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), ST_geomfromtext('linestring(0 1, 1 0)'));
ST_DISTANCE(ST_geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), ST_geomfromtext('linestring(0 1, 1 0)'))
0
select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 3 6, 6 3, 0 0))'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))'));
ST_DISTANCE(ST_geomfromtext('polygon((0 0, 3 6, 6 3, 0 0))'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))'))
0
select ST_DISTANCE(ST_geomfromtext('polygon((0 0, 3 6, 6 3, 0 0),(2 2, 3 4, 4 3, 2 2))'), ST_geomfromtext('point(3 3)'));
ST_DISTANCE(ST_geomfromtext('polygon((0 0, 3 6, 6 3, 0 0),(2 2, 3 4, 4 3, 2 2))'), ST_geomfromtext('point(3 3)'))
0.4472135954999579
select ST_DISTANCE(ST_geomfromtext('linestring(0 0, 3 6, 6 3, 0 0)'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))'));
ST_DISTANCE(ST_geomfromtext('linestring(0 0, 3 6, 6 3, 0 0)'), ST_geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))'))
0.8944271909999159
select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')));
ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')))
POLYGON((21.951219512195124 27.4390243902439,26.470588235294116 23.823529411764707,29.28994082840237 26.36094674556213,23.85542168674699 29.819277108433734,21.951219512195124 27.4390243902439))
select ST_astext(ST_Intersection(ST_GeomFromText('LINESTRING(0 0, 50 45, 40 50, 0 0)'), ST_GeomFromText('LINESTRING(50 5, 55 10, 0 45, 50 5)')));
ST_astext(ST_Intersection(ST_GeomFromText('LINESTRING(0 0, 50 45, 40 50, 0 0)'), ST_GeomFromText('LINESTRING(50 5, 55 10, 0 45, 50 5)')))
MULTIPOINT((26.470588235294116 23.823529411764707),(29.28994082840237 26.36094674556213),(23.85542168674699 29.819277108433734),(21.951219512195124 27.4390243902439))
select ST_astext(ST_Intersection(ST_GeomFromText('LINESTRING(0 0, 50 45, 40 50)'), ST_GeomFromText('LINESTRING(50 5, 55 10, 0 45)')));
ST_astext(ST_Intersection(ST_GeomFromText('LINESTRING(0 0, 50 45, 40 50)'), ST_GeomFromText('LINESTRING(50 5, 55 10, 0 45)')))
POINT(29.28994082840237 26.36094674556213)
select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POINT(20 20)')));
ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('POINT(20 20)')))
POINT(20 20)
select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200)')));
ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200)')))
LINESTRING(0 0,46.666666666666664 46.666666666666664)
select ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)')));
ST_astext(ST_Intersection(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)')))
GEOMETRYCOLLECTION(LINESTRING(0 0,46.666666666666664 46.666666666666664),LINESTRING(45.333333333333336 47.333333333333336,8 10))
select ST_astext(ST_UNION(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)')));
ST_astext(ST_UNION(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)')))
GEOMETRYCOLLECTION(POLYGON((0 0,50 45,40 50,0 0)),LINESTRING(-10 -10,0 0),LINESTRING(46.666666666666664 46.666666666666664,200 200,199 201,45.333333333333336 47.333333333333336),LINESTRING(8 10,-11 -9))
select ST_astext(ST_intersection(ST_geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), ST_geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))')));
ST_astext(ST_intersection(ST_geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), ST_geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))')))
POLYGON((0 1,0 0,0.5 0.5,0 1))
select ST_astext(ST_symdifference(ST_geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), ST_geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))')));
ST_astext(ST_symdifference(ST_geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), ST_geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))')))
MULTIPOLYGON(((0.5 0.5,0 0,1 0,0.5 0.5)),((0.5 0.5,1 1,0 2,0 1,0.5 0.5)))
select ST_astext(ST_UNION(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)')));
ST_astext(ST_UNION(ST_GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), ST_GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)')))
GEOMETRYCOLLECTION(POLYGON((0 0,50 45,40 50,0 0)),LINESTRING(-10 -10,0 0),LINESTRING(46.666666666666664 46.666666666666664,200 200,199 201,45.333333333333336 47.333333333333336),LINESTRING(8 10,-11 -9))
select ST_astext(ST_buffer(ST_geometryfromtext('point(1 1)'), 1));
ST_astext(ST_buffer(ST_geometryfromtext('point(1 1)'), 1))
POLYGON((2 1,1.98078528040323 1.19509032201612,1.92387953251129 1.38268343236509,1.83146961230255 1.5555702330196,1.70710678118655 1.70710678118655,1.5555702330196 1.83146961230254,1.38268343236509 1.92387953251129,1.19509032201613 1.98078528040323,1 2,0.80490967798387 1.98078528040323,0.61731656763491 1.92387953251129,0.4444297669804 1.83146961230255,0.29289321881345 1.70710678118655,0.16853038769746 1.5555702330196,0.07612046748871 1.38268343236509,0.01921471959677 1.19509032201613,0 1,0.01921471959677 0.80490967798387,0.07612046748871 0.61731656763491,0.16853038769745 0.4444297669804,0.29289321881345 0.29289321881345,0.4444297669804 0.16853038769745,0.61731656763491 0.07612046748871,0.80490967798387 0.01921471959677,1 0,1.19509032201613 0.01921471959677,1.38268343236509 0.07612046748871,1.5555702330196 0.16853038769745,1.70710678118655 0.29289321881345,1.83146961230255 0.4444297669804,1.92387953251129 0.61731656763491,1.98078528040323 0.80490967798387,2 1))
create table t1(geom geometrycollection)engine=innodb;
insert into t1 values (ST_geomfromtext('POLYGON((0 0, 10 10, 0 8, 0 0))'));
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (ST_geomfromtext('POLYGON((1 1, 10 10, 0 8, 1 1))'));
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
select ST_astext(geom), ST_area(geom),ST_area(ST_buffer(geom,2)) from t1;
ST_astext(geom)	ST_area(geom)	ST_area(ST_buffer(geom,2))
select ST_NUMPOINTS(ST_EXTERIORRING(ST_buffer(geom,2))) from t1;
ST_NUMPOINTS(ST_EXTERIORRING(ST_buffer(geom,2)))
set @geom=ST_geomfromtext('LINESTRING(2 1, 4 2, 2 3, 2 5)');
set @buff=ST_buffer(@geom,1);
select ST_NUMPOINTS(ST_EXTERIORRING(@buff)) from t1;
ST_NUMPOINTS(ST_EXTERIORRING(@buff))
DROP TABLE t1;
select st_touches(ST_geomfromtext('point(0 0)'), ST_geomfromtext('point(1 1)'));
st_touches(ST_geomfromtext('point(0 0)'), ST_geomfromtext('point(1 1)'))
NULL
select st_touches(ST_geomfromtext('point(1 1)'), ST_geomfromtext('point(1 1)'));
st_touches(ST_geomfromtext('point(1 1)'), ST_geomfromtext('point(1 1)'))
NULL
select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 1)'));
st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 1)'))
1
select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 0)'));
st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 0)'))
0
select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 2)'));
st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('point(1 2)'))
0
select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))'));
st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))'))
0
select st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))'));
st_touches(ST_geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), ST_geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))'))
1
SELECT ST_Equals(ST_PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),ST_PolyFromText('POLYGON((67 13, 67 18, 59 19, 59 13, 59 13, 67 13) )')) as result;
result
0
SELECT ST_Equals(ST_PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),ST_PolyFromText('POLYGON((67 13, 67 18, 59 18, 59 13, 59 13, 67 13) )')) as result;
result
1
SELECT ST_Equals(ST_PointFromText('POINT (12 13)'),ST_PointFromText('POINT (12 13)')) as result;
result
1
#
# BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD
# BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL
#
# Invalid geometry in input.
DO ST_ASTEXT(ST_UNION(ST_GEOMFROMTEXT('POLYGON((525000 183300,525400
183300,525400 18370, 525000 183700,525000 183300))'),
ST_geomfromtext('POLYGON((525298.67 183511.53,525296.57
183510.39,525296.42 183510.31,525289.11 183506.62,525283.17
183503.47,525280.98 183502.26,525278.63 183500.97,525278.39
183500.84,525276.79 183500,525260.7 183491.55,525263.95
183484.75,525265.58 183481.95,525278.97 183488.73,525276.5
183493.45,525275.5 183495.7,525280.35 183498.2,525282.3
183499.1,525282.2 183499.3,525283.55 183500,525301.75
183509.35,525304.45 183504.25,525307.85 183504.95,525304.5
183510.83,525302.81 183513.8,525298.67 183511.53),(525275.06
183489.89,525272.06 183488.37,525268.94 183494.51,525271.94
183496.03,525275.06 183489.89),(525263.26 183491.55,525266.15
183493.04,525269.88 183485.82,525266.99 183484.33,525263.26
183491.55))'))) st_u;
SET @a=0x0000000001030000000200000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000000000000000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000400000000000000040000000000000F03F0000000000000040000000000000F03F000000000000F03F;
SELECT ST_ASTEXT(ST_TOUCHES(@a, ST_GEOMFROMTEXT('point(0 0)'))) t;
ERROR 22023: Invalid GIS data provided to function st_touches.
DROP TABLE IF EXISTS p1;
CREATE PROCEDURE p1(dist DOUBLE, geom TEXT)
BEGIN
DECLARE g GEOMETRY;
SET g=ST_GeomFromText(geom);
SELECT geom AS `-----`;
SELECT dist, ST_GeometryType(@buf:=ST_Buffer(g, dist)) AS `buffer`, ROUND(ST_AREA(@buf),2) AS buf_area;
END|
Warnings:
Warning	1287	Setting user variables within expressions is deprecated and will be removed in a future release. Consider alternatives: 'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'.
#
# Testing ST_BUFFER with positive distance
#
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
-----
POINT(0 0)
dist	buffer	buf_area
1	POLYGON	3.12
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
-----
LineString(0 1, 1 1)
dist	buffer	buf_area
1	POLYGON	5.12
-----
LineString(9 9,8 1,1 5,0 0)
dist	buffer	buf_area
1	POLYGON	44.6
-----
Polygon((2 2,2 8,8 8,8 2,2 2))
dist	buffer	buf_area
1	POLYGON	63.12
-----
Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2))
dist	buffer	buf_area
1	POLYGON	95.12
-----
Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))
dist	buffer	buf_area
1	POLYGON	174.9
-----
MultiPoint(9 9,8 1,1 5)
dist	buffer	buf_area
1	MULTIPOLYGON	9.36
-----
MultiLineString((0 0,2 2))
dist	buffer	buf_area
1	POLYGON	8.78
-----
MultiLineString((0 0,2 2,0 4))
dist	buffer	buf_area
1	POLYGON	14.22
-----
MultiLineString((0 0,2 2),(0 2,2 0))
dist	buffer	buf_area
1	POLYGON	13.56
-----
MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14))
dist	buffer	buf_area
1	MULTIPOLYGON	70.01
-----
MultiLineString((0 0,0 1),(3 0,3 1))
dist	buffer	buf_area
1	MULTIPOLYGON	10.24
# Invalid geometry in input
-----
MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9)))
dist	buffer	buf_area
1	POLYGON	73.16
# Invalid geometry in input
-----
MultiPolygon(((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),((9 9,8 1,1 5,9 9)))
dist	buffer	buf_area
1	POLYGON	73.16
-----
GeometryCollection(Point(0 0))
dist	buffer	buf_area
1	POLYGON	3.12
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
-----
GeometryCollection(LineString(0 0, 2 2))
dist	buffer	buf_area
1	POLYGON	8.78
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
-----
GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2)))
dist	buffer	buf_area
1	POLYGON	63.12
-----
GeometryCollection(MultiPoint(9 9,8 1,1 5))
dist	buffer	buf_area
1	MULTIPOLYGON	9.36
-----
GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1)))
dist	buffer	buf_area
1	MULTIPOLYGON	10.24
-----
GeometryCollection(MultiPolygon(((0 0, 3 0, 3 3, 0 3, 0 0)),((6 6,6 9,9 9,9 6,6 6))))
dist	buffer	buf_area
1	MULTIPOLYGON	48.24
-----
GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2)))
dist	buffer	buf_area
1	POLYGON	75.88
#
# Testing ST_BUFFER with zero distance
#
-----
Polygon((2 2,2 8,8 8,8 2,2 2))
dist	buffer	buf_area
0	POLYGON	36
-----
Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2))
dist	buffer	buf_area
0	POLYGON	48
-----
Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))
dist	buffer	buf_area
0	POLYGON	116
# Invalid geometry in input
-----
MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9)))
dist	buffer	buf_area
0	MULTIPOLYGON	66
# Invalid geometry in input
-----
MultiPolygon(((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),((9 9,8 1,1 5,9 9)))
dist	buffer	buf_area
0	MULTIPOLYGON	62
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
#
# Testing ST_BUFFER with negative distance
#
-----
POINT(0 0)
ERROR HY000: Incorrect arguments to st_buffer
-----
LineString(0 1, 1 1)
ERROR HY000: Incorrect arguments to st_buffer
-----
LineString(9 9,8 1,1 5,0 0)
ERROR HY000: Incorrect arguments to st_buffer
-----
Polygon((2 2,2 8,8 8,8 2,2 2))
dist	buffer	buf_area
-1	POLYGON	16
-----
Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2))
dist	buffer	buf_area
-1	MULTIPOLYGON	0.88
-----
Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))
dist	buffer	buf_area
-1	POLYGON	64.22
-----
MultiPoint(9 9,8 1,1 5)
ERROR HY000: Incorrect arguments to st_buffer
-----
MultiLineString((0 0,2 2))
ERROR HY000: Incorrect arguments to st_buffer
-----
MultiLineString((0 0,2 2,0 4))
ERROR HY000: Incorrect arguments to st_buffer
-----
MultiLineString((0 0,2 2),(0 2,2 0))
ERROR HY000: Incorrect arguments to st_buffer
-----
MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14))
ERROR HY000: Incorrect arguments to st_buffer
# Invalid geometry in input
-----
MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9)))
dist	buffer	buf_area
-1	POLYGON	8
# Invalid geometry in input
-----
MultiPolygon(((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),((9 9,8 1,1 5,9 9)))
dist	buffer	buf_area
-1	MULTIPOLYGON	0.74
-----
GeometryCollection(Point(0 0))
ERROR HY000: Incorrect arguments to st_buffer
-----
GeometryCollection(LineString(0 0, 2 2))
ERROR HY000: Incorrect arguments to st_buffer
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
-----
GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2)))
dist	buffer	buf_area
-1	POLYGON	16
-----
GeometryCollection(MultiPoint(9 9,8 1,1 5))
ERROR HY000: Incorrect arguments to st_buffer
-----
GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1)))
ERROR HY000: Incorrect arguments to st_buffer
-----
GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2)))
ERROR HY000: Incorrect arguments to st_buffer
SELECT ST_CONTAINS(
ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
ST_GeomFromText('POINT(5 10)'));
ST_CONTAINS(
ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
ST_GeomFromText('POINT(5 10)'))
0
SELECT ST_AsText(ST_UNION(
ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
ST_GeomFromText('POINT(5 10)')));
ST_AsText(ST_UNION(
ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
ST_GeomFromText('POINT(5 10)')))
GEOMETRYCOLLECTION(POLYGON((0 0,5 0,5 5,0 5,0 0)),POLYGON((6 6,11 6,11 11,6 11,6 6)),POINT(5 10))
DROP PROCEDURE p1;
#
# Bug #13833019 ASSERTION `T1->RESULT_RANGE' FAILED IN GCALC_OPERATION_REDUCER::END_COUPLE
#
SELECT ST_GeometryType(ST_BUFFER(ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3));
ST_GeometryType(ST_BUFFER(ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3))
POLYGON
#
# Bug #13832749 	HANDLE_FATAL_SIGNAL IN GCALC_FUNCTION::COUNT_INTERNAL
#
SELECT ST_GeometryType(ST_BUFFER(ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1));
ST_GeometryType(ST_BUFFER(ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1))
POLYGON
#
# Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER
#
DO ST_BUFFER(ST_LINEFROMTEXT('linestring(1 1,2 2)'),'');
SELECT ST_WITHIN(
ST_LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '),
ST_BUFFER(ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '),
ST_NUMINTERIORRINGS(ST_POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) '))));
ST_WITHIN(
ST_LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '),
ST_BUFFER(ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5
0
SELECT ST_DIMENSION(ST_BUFFER(ST_POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '),
ST_NUMINTERIORRINGS(ST_POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))'))));
ST_DIMENSION(ST_BUFFER(ST_POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '),
ST_NUMINTERIORRINGS(ST_POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))'))))
2
SELECT ST_NUMINTERIORRINGS(
ST_ENVELOPE(ST_BUFFER(ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '),
ST_SRID(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) ')))));
ST_NUMINTERIORRINGS(
ST_ENVELOPE(ST_BUFFER(ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '),
ST_SRID(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) ')))))
0
SELECT ST_ASTEXT(ST_BUFFER(ST_POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'),
ST_SRID(ST_GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) '))));
ST_ASTEXT(ST_BUFFER(ST_POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'),
ST_SRID(ST_GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) '))))
POLYGON((9 9,5 2,4 5,9 9))
#
# 18701868 CRASH IN MY_DECIMAL::SANITY_CHECK,
#          ORDER BY CAST (INVALID GIS FUNCTION RESULT)
#
CREATE TABLE t1 (a INT) engine=innodb;
INSERT INTO t1 VALUES (1);
SELECT * FROM t1 ORDER BY cast(st_distance(1,1) as DECIMAL);
a
1
DELETE FROM t1 ORDER BY cast(st_distance(1,1) as DECIMAL);
ERROR 22023: Invalid GIS data provided to function st_distance.
UPDATE t1 SET a=1 ORDER BY cast(st_distance(1,1) as DECIMAL);
ERROR 22023: Invalid GIS data provided to function st_distance.
DROP TABLE t1;