~ubuntu-branches/ubuntu/trusty/postgis/trusty-proposed

« back to all changes in this revision

Viewing changes to extras/ogc_test_suite/2_queries.sql

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2014-04-04 20:16:30 UTC
  • mfrom: (1.1.18)
  • Revision ID: package-import@ubuntu.com-20140404201630-jbromdp48v4887w7
Tags: 2.1.2+dfsg-1
* Add myself to Uploaders.
* Update copyright file using copyright-format 1.0.
* Repack upstream tarball, remove OGC test cases with unclear license.
  (closes: #743489)
* Add gbp.conf to use pristine-tar by default.
* Add man page for raster2pgsql.
  (closes: #717307)
* Bump Debhelper compatibility to 9.
* Add partial German translation for documentation.
  Thanks to Chris Leick for the patch.
  (closes: #729284)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--
2
 
--345678901234567890123456789012345678901234567890123456789012345678901234567890
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
 
SELECT f_table_name
36
 
FROM geometry_columns;
37
 
--
38
 
--
39
 
--================================
40
 
--
41
 
--
42
 
--================================
43
 
--
44
 
SELECT f_geometry_column
45
 
FROM geometry_columns
46
 
WHERE f_table_name = 'streams';
47
 
--
48
 
--
49
 
--================================
50
 
--
51
 
--
52
 
--================================
53
 
--
54
 
SELECT coord_dimension
55
 
FROM geometry_columns
56
 
WHERE f_table_name = 'streams';
57
 
--
58
 
--
59
 
--================================
60
 
--
61
 
--
62
 
--================================
63
 
--
64
 
SELECT srid
65
 
FROM geometry_columns
66
 
WHERE f_table_name = 'streams';
67
 
--
68
 
--
69
 
--================================
70
 
--
71
 
--
72
 
--================================
73
 
--
74
 
SELECT srtext
75
 
FROM SPATIAL_REF_SYS
76
 
WHERE SRID = 101;
77
 
--
78
 
--
79
 
--
80
 
--//////////////////////////////////////////////////////////////////////////////
81
 
--
82
 
--
83
 
--//////////////////////////////////////////////////////////////////////////////
84
 
--
85
 
--================================
86
 
--
87
 
--
88
 
--================================
89
 
--
90
 
SELECT Dimension(shore) 
91
 
FROM lakes 
92
 
WHERE name = 'Blue Lake';
93
 
--
94
 
--
95
 
--================================
96
 
--
97
 
--
98
 
--================================
99
 
--
100
 
SELECT GeometryType(centerlines) 
101
 
FROM divided_routes 
102
 
WHERE name = 'Route 75';
103
 
--
104
 
--================================
105
 
--
106
 
--
107
 
--================================
108
 
--
109
 
SELECT AsText(boundary) 
110
 
FROM named_places 
111
 
WHERE name = 'Goose Island';
112
 
--
113
 
--================================
114
 
--
115
 
--
116
 
--================================
117
 
--
118
 
SELECT AsText(PolygonFromWKB(AsBinary(boundary))) 
119
 
FROM named_places 
120
 
WHERE name = 'Goose Island';
121
 
--
122
 
--================================
123
 
--
124
 
--
125
 
--================================
126
 
--
127
 
SELECT SRID(boundary) 
128
 
FROM named_places 
129
 
WHERE name = 'Goose Island';
130
 
--
131
 
--================================
132
 
--
133
 
--
134
 
--================================
135
 
--
136
 
SELECT IsEmpty(centerline) 
137
 
FROM road_segments 
138
 
WHERE name = 'Route 5' AND aliases = 'Main Street';
139
 
--
140
 
--================================
141
 
--
142
 
--
143
 
--================================
144
 
--
145
 
SELECT IsSimple(shore) 
146
 
FROM lakes 
147
 
WHERE name = 'Blue Lake';
148
 
--
149
 
--================================
150
 
--
151
 
--================================
152
 
--
153
 
SELECT AsText(Boundary(boundary)) 
154
 
FROM named_places 
155
 
WHERE name = 'Goose Island';
156
 
--
157
 
--================================
158
 
--
159
 
--================================
160
 
--
161
 
SELECT AsText(Envelope(boundary)) 
162
 
FROM named_places 
163
 
WHERE name = 'Goose Island';
164
 
--
165
 
--
166
 
--
167
 
--//////////////////////////////////////////////////////////////////////////////
168
 
--
169
 
--
170
 
--//////////////////////////////////////////////////////////////////////////////
171
 
--
172
 
--================================
173
 
--
174
 
--================================
175
 
--
176
 
SELECT X(position) 
177
 
FROM bridges 
178
 
WHERE name = 'Cam Bridge';
179
 
--
180
 
--================================
181
 
--
182
 
--================================
183
 
--
184
 
SELECT Y(position) 
185
 
FROM bridges 
186
 
WHERE name = 'Cam Bridge';
187
 
--
188
 
--
189
 
--
190
 
--//////////////////////////////////////////////////////////////////////////////
191
 
--
192
 
--
193
 
--//////////////////////////////////////////////////////////////////////////////
194
 
--
195
 
--================================
196
 
--
197
 
--
198
 
--================================
199
 
--
200
 
SELECT AsText(StartPoint(centerline))
201
 
FROM road_segments 
202
 
WHERE fid = 102;
203
 
--
204
 
--================================
205
 
--
206
 
--
207
 
--================================
208
 
--
209
 
SELECT AsText(EndPoint(centerline))
210
 
FROM road_segments 
211
 
WHERE fid = 102;
212
 
--
213
 
--================================
214
 
--
215
 
--================================
216
 
--
217
 
SELECT IsClosed(Boundary(boundary)) 
218
 
FROM named_places 
219
 
WHERE name = 'Goose Island';
220
 
--
221
 
--================================
222
 
--
223
 
--================================
224
 
--
225
 
SELECT IsRing(Boundary(boundary)) 
226
 
FROM named_places 
227
 
WHERE name = 'Goose Island';
228
 
--
229
 
--================================
230
 
--
231
 
--
232
 
--================================
233
 
--
234
 
SELECT Length(centerline)
235
 
FROM road_segments 
236
 
WHERE fid = 106;
237
 
--
238
 
--
239
 
--
240
 
--//////////////////////////////////////////////////////////////////////////////
241
 
--
242
 
--
243
 
--//////////////////////////////////////////////////////////////////////////////
244
 
--
245
 
--================================
246
 
--
247
 
--
248
 
--================================
249
 
--
250
 
SELECT NumPoints(centerline)
251
 
FROM road_segments 
252
 
WHERE fid = 102;
253
 
--
254
 
--================================
255
 
--
256
 
--
257
 
--================================
258
 
--
259
 
SELECT AsText(PointN(centerline, 1))
260
 
FROM road_segments 
261
 
WHERE fid = 102;
262
 
--
263
 
--
264
 
--
265
 
--//////////////////////////////////////////////////////////////////////////////
266
 
--
267
 
--
268
 
--//////////////////////////////////////////////////////////////////////////////
269
 
--
270
 
--================================
271
 
--
272
 
--
273
 
--================================
274
 
--
275
 
SELECT AsText(Centroid(boundary))
276
 
FROM named_places 
277
 
WHERE name = 'Goose Island';
278
 
--
279
 
--================================
280
 
--
281
 
--
282
 
--================================
283
 
--
284
 
SELECT Contains(boundary, PointOnSurface(boundary))
285
 
FROM named_places 
286
 
WHERE name = 'Goose Island';
287
 
--
288
 
--================================
289
 
--
290
 
--
291
 
--================================
292
 
--
293
 
SELECT Area(boundary)
294
 
FROM named_places 
295
 
WHERE name = 'Goose Island';
296
 
--
297
 
--
298
 
--
299
 
--//////////////////////////////////////////////////////////////////////////////
300
 
--
301
 
--
302
 
--//////////////////////////////////////////////////////////////////////////////
303
 
--
304
 
--================================
305
 
--
306
 
--
307
 
--================================
308
 
--
309
 
SELECT AsText(ExteriorRing(shore))
310
 
FROM lakes 
311
 
WHERE name = 'Blue Lake';
312
 
--
313
 
--================================
314
 
--
315
 
--
316
 
--================================
317
 
--
318
 
SELECT NumInteriorRings(shore)
319
 
FROM lakes 
320
 
WHERE name = 'Blue Lake';
321
 
--
322
 
--================================
323
 
--
324
 
--
325
 
--================================
326
 
--
327
 
SELECT AsText(InteriorRingN(shore, 1))
328
 
FROM lakes 
329
 
WHERE name = 'Blue Lake';
330
 
--
331
 
--
332
 
--
333
 
--//////////////////////////////////////////////////////////////////////////////
334
 
--
335
 
--
336
 
--//////////////////////////////////////////////////////////////////////////////
337
 
--
338
 
--================================
339
 
--
340
 
--
341
 
--================================
342
 
--
343
 
SELECT NumGeometries(centerlines)
344
 
FROM divided_routes 
345
 
WHERE name = 'Route 75';
346
 
--
347
 
--================================
348
 
--
349
 
--
350
 
--================================
351
 
--
352
 
SELECT AsText(GeometryN(centerlines, 2))
353
 
FROM divided_routes 
354
 
WHERE name = 'Route 75';
355
 
--
356
 
--
357
 
--
358
 
--//////////////////////////////////////////////////////////////////////////////
359
 
--
360
 
--
361
 
--//////////////////////////////////////////////////////////////////////////////
362
 
--
363
 
--================================
364
 
--
365
 
--
366
 
--================================
367
 
--
368
 
SELECT IsClosed(centerlines)
369
 
FROM divided_routes 
370
 
WHERE name = 'Route 75';
371
 
--
372
 
--================================
373
 
--
374
 
--
375
 
--================================
376
 
--
377
 
SELECT Length(centerlines)
378
 
FROM divided_routes 
379
 
WHERE name = 'Route 75';
380
 
--
381
 
--
382
 
--
383
 
--//////////////////////////////////////////////////////////////////////////////
384
 
--
385
 
--
386
 
--//////////////////////////////////////////////////////////////////////////////
387
 
--
388
 
--================================
389
 
--
390
 
--
391
 
--================================
392
 
--
393
 
SELECT AsText(Centroid(shores))
394
 
FROM ponds 
395
 
WHERE fid = 120;
396
 
--
397
 
--================================
398
 
--
399
 
--
400
 
--================================
401
 
--
402
 
SELECT Contains(shores, PointOnSurface(shores))
403
 
FROM ponds 
404
 
WHERE fid = 120;
405
 
--
406
 
--================================
407
 
--
408
 
--
409
 
--================================
410
 
--
411
 
SELECT Area(shores)
412
 
FROM ponds 
413
 
WHERE fid = 120;
414
 
--
415
 
--
416
 
--
417
 
--//////////////////////////////////////////////////////////////////////////////
418
 
--
419
 
--
420
 
--//////////////////////////////////////////////////////////////////////////////
421
 
--
422
 
--================================
423
 
--
424
 
--
425
 
--================================
426
 
--
427
 
SELECT Equals(boundary, PolygonFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
428
 
FROM named_places 
429
 
WHERE name = 'Goose Island';
430
 
--
431
 
--================================
432
 
--
433
 
--
434
 
--================================
435
 
--
436
 
SELECT Disjoint(centerlines, boundary)
437
 
FROM divided_routes, named_places 
438
 
WHERE divided_routes.name = 'Route 75' AND named_places.name = 'Ashton';
439
 
--
440
 
--================================
441
 
--
442
 
--
443
 
--================================
444
 
--
445
 
SELECT Touches(centerline, shore)
446
 
FROM streams, lakes 
447
 
WHERE streams.name = 'Cam Stream' AND lakes.name = 'Blue Lake';
448
 
--
449
 
--================================
450
 
--
451
 
--
452
 
--================================
453
 
--
454
 
SELECT Within(footprint, boundary)
455
 
FROM named_places, buildings 
456
 
WHERE named_places.name = 'Ashton' AND buildings.address = '215 Main Street';
457
 
--
458
 
--================================
459
 
--
460
 
--
461
 
--================================
462
 
--
463
 
SELECT Overlaps(forests.boundary, named_places.boundary)
464
 
FROM forests, named_places 
465
 
WHERE forests.name = 'Green Forest' AND named_places.name = 'Ashton';
466
 
--
467
 
--================================
468
 
--
469
 
--
470
 
--================================
471
 
--
472
 
SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
473
 
FROM road_segments, divided_routes 
474
 
WHERE road_segments.fid = 102 AND divided_routes.name = 'Route 75';
475
 
--
476
 
--================================
477
 
--
478
 
--
479
 
--================================
480
 
--
481
 
SELECT Intersects(road_segments.centerline, divided_routes.centerlines)
482
 
FROM road_segments, divided_routes 
483
 
WHERE road_segments.fid = 102 AND divided_routes.name = 'Route 75';
484
 
--
485
 
--================================
486
 
--
487
 
--
488
 
--================================
489
 
--
490
 
SELECT Contains(forests.boundary, named_places.boundary)
491
 
FROM forests, named_places 
492
 
WHERE forests.name = 'Green Forest' AND named_places.name = 'Ashton';
493
 
--
494
 
--================================
495
 
--
496
 
--
497
 
--================================
498
 
--
499
 
SELECT Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT')
500
 
FROM forests, named_places 
501
 
WHERE forests.name = 'Green Forest' AND named_places.name = 'Ashton';
502
 
--
503
 
--
504
 
--
505
 
--//////////////////////////////////////////////////////////////////////////////
506
 
--
507
 
--
508
 
--//////////////////////////////////////////////////////////////////////////////
509
 
--
510
 
--================================
511
 
--
512
 
--
513
 
--================================
514
 
--
515
 
SELECT Distance(position, boundary)
516
 
FROM bridges, named_places 
517
 
WHERE bridges.name = 'Cam Bridge' AND named_places.name = 'Ashton';
518
 
--
519
 
--
520
 
--
521
 
--//////////////////////////////////////////////////////////////////////////////
522
 
--
523
 
--
524
 
--//////////////////////////////////////////////////////////////////////////////
525
 
--
526
 
--================================
527
 
--
528
 
--
529
 
--================================
530
 
--
531
 
SELECT AsText(Intersection(centerline, shore))
532
 
FROM streams, lakes 
533
 
WHERE streams.name = 'Cam Stream' AND lakes.name = 'Blue Lake';
534
 
--
535
 
--================================
536
 
--
537
 
--
538
 
--================================
539
 
--
540
 
SELECT AsText(Difference(named_places.boundary, forests.boundary))
541
 
FROM named_places, forests 
542
 
WHERE named_places.name = 'Ashton' AND forests.name = 'Green Forest';
543
 
--
544
 
--================================
545
 
--
546
 
--
547
 
--================================
548
 
--
549
 
SELECT AsText(GeomUnion(shore, boundary))
550
 
FROM lakes, named_places 
551
 
WHERE lakes.name = 'Blue Lake' AND named_places.name = 'Goose Island';
552
 
--
553
 
--================================
554
 
--
555
 
--
556
 
--================================
557
 
--
558
 
SELECT AsText(SymmetricDifference(shore, boundary))
559
 
FROM lakes, named_places 
560
 
WHERE lakes.name = 'Blue Lake' AND named_places.name = 'Goose Island';
561
 
--
562
 
--================================
563
 
--
564
 
--
565
 
--================================
566
 
--
567
 
SELECT count(*)
568
 
FROM buildings, bridges
569
 
WHERE Contains(Buffer(bridges.position, 15.0), buildings.footprint);
570
 
--
571
 
--================================
572
 
--
573
 
--
574
 
--================================
575
 
--
576
 
SELECT AsText(ConvexHull(shore))
577
 
FROM lakes
578
 
WHERE lakes.name = 'Blue Lake';
579
 
 
580
 
 
581
 
--
582
 
--
583
 
--