File: reference_accessor.xml

package info (click to toggle)
postgis 1.5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 17,296 kB
  • sloc: sql: 77,621; ansic: 59,025; xml: 18,553; sh: 11,043; java: 6,061; perl: 2,133; makefile: 981; yacc: 299; python: 192
file content (1866 lines) | stat: -rw-r--r-- 50,886 bytes parent folder | download | duplicates (2)
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
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
<?xml version="1.0" encoding="UTF-8"?>

  <sect1 id="Geometry_Accessors">
	<title>Geometry Accessors</title>

	<refentry id="GeometryType">
	  <refnamediv>
		<refname>GeometryType</refname>

		<refpurpose>Returns the type of the geometry as a string. Eg:
			'LINESTRING', 'POLYGON', 'MULTIPOINT', etc.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>GeometryType</function></funcdef>
			<paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns the type of the geometry as a string. Eg:
		'LINESTRING', 'POLYGON', 'MULTIPOINT', etc.</para>

		<para>OGC SPEC s2.1.1.1 - Returns the name of the instantiable
		subtype of Geometry of which this Geometry instance is a member.
		The name of the instantiable subtype of Geometry is returned as a
		string.</para>

		<note>
		  <para>This function also indicates if the geometry is measured,
		  by returning a string of the form 'POINTM'.</para>
		</note>

		<para>&sfs_compliant;</para>
		<para>&curve_support;</para>

	  </refsection>


	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT GeometryType(ST_GeomFromText('LINESTRING(77.29 29.07,77.42 29.26,77.27 29.31,77.29 29.07)'));
 geometrytype
--------------
 LINESTRING
</programlisting>
	  </refsection>

	  <!-- Optionally add a "See Also" section -->
	  <refsection>
		<title>See Also</title>
		<para><xref linkend="ST_GeometryType" /></para>
	  </refsection>
	</refentry>
	<refentry id="ST_Boundary">
	  <refnamediv>
		<refname>ST_Boundary</refname>

		<refpurpose>Returns the closure of the combinatorial boundary of this
			Geometry.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>geometry <function>ST_Boundary</function></funcdef>

			<paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns the closure of the combinatorial boundary of this
			Geometry. The combinatorial boundary is defined as described in
			section 3.12.3.2 of the OGC SPEC. Because the result of this
			function is a closure, and hence topologically closed, the
			resulting boundary can be represented using representational
			geometry primitives as discussed in the OGC SPEC, section
			3.12.2.</para>
		<para>Performed by the GEOS module</para>
		<important>
		  <para>Do not call with a <varname>GEOMETRYCOLLECTION</varname> as an argument</para>
		</important>

		<para>&sfs_compliant; OGC SPEC s2.1.1.1</para>
		<para>&sqlmm_compliant; SQL-MM 3: 5.1.14</para>
		<para>&Z_support;</para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		 <programlisting>SELECT ST_AsText(ST_Boundary(ST_GeomFromText('LINESTRING(1 1,0 0, -1 1)')));
st_astext
-----------
MULTIPOINT(1 1,-1 1)

SELECT ST_AsText(ST_Boundary(ST_GeomFromText('POLYGON((1 1,0 0, -1 1, 1 1))')));
st_astext
----------
LINESTRING(1 1,0 0,-1 1,1 1)

--Using a 3d polygon
SELECT ST_AsEWKT(ST_Boundary(ST_GeomFromEWKT('POLYGON((1 1 1,0 0 1, -1 1 1, 1 1 1))')));

st_asewkt
-----------------------------------
LINESTRING(1 1 1,0 0 1,-1 1 1,1 1 1)

--Using a 3d multilinestring
SELECT ST_AsEWKT(ST_Boundary(ST_GeomFromEWKT('MULTILINESTRING((1 1 1,0 0 0.5, -1 1 1),(1 1 0.5,0 0 0.5, -1 1 0.5, 1 1 0.5) )')));

st_asewkt
----------
MULTIPOINT(-1 1 1,1 1 0.75)
</programlisting>
		</refsection>
		<refsection>
			<title>See Also</title>

			<para><xref linkend="ST_ExteriorRing" />, <xref linkend="ST_MakePolygon" /></para>
		</refsection>
	</refentry>

	<refentry id="ST_CoordDim">
	  <refnamediv>
		<refname>ST_CoordDim</refname>

		<refpurpose><para>Return the coordinate dimension of the ST_Geometry value.</para></refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>integer <function>ST_CoordDim</function></funcdef>
			<paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Return the coordinate dimension of the ST_Geometry value.</para>

		<para>This is the MM compliant alias name for <xref linkend="ST_NDims" /></para>

		<para>&sfs_compliant;</para>
		<para>&sqlmm_compliant; SQL-MM 3: 5.1.3</para>
		<para>&curve_support;</para>
		<para>&Z_support;</para>

	  </refsection>


	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT ST_CoordDim('CIRCULARSTRING(1 2 3, 1 3 4, 5 6 7, 8 9 10, 11 12 13)');
			---result--
				3

				SELECT ST_CoordDim(ST_Point(1,2));
			--result--
				2

		</programlisting>
	  </refsection>

	  <!-- Optionally add a "See Also" section -->
	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_NDims" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_Dimension">
	  <refnamediv>
		<refname>ST_Dimension</refname>

		<refpurpose>The inherent dimension of this Geometry object, which must
			be less than or equal to the coordinate dimension. </refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>integer <function>ST_Dimension</function></funcdef>

			<paramdef><type>geometry </type> <parameter>g</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>The inherent dimension of this Geometry object, which must
			be less than or equal to the coordinate dimension. OGC SPEC
			s2.1.1.1 - returns 0 for <varname>POINT</varname>, 1 for <varname>LINESTRING</varname>, 2 for <varname>POLYGON</varname>, and
			the largest dimension of the components of a
			<varname>GEOMETRYCOLLECTION</varname>.</para>

		<para>&sqlmm_compliant; SQL-MM 3: 5.1.2</para>

	  </refsection>

	  <refsection>
		<title>Examples</title>

		 <programlisting>SELECT ST_Dimension('GEOMETRYCOLLECTION(LINESTRING(1 1,0 0),POINT(0 0))');
ST_Dimension
-----------
1
</programlisting>
		</refsection>
		<refsection>
			<title>See Also</title>

			<para><xref linkend="ST_NDims" /></para>
		</refsection>
	</refentry>

	<refentry id="ST_EndPoint">
	  <refnamediv>
		<refname>ST_EndPoint</refname>

		<refpurpose>Returns the last point of a <varname>LINESTRING</varname>
		geometry as a <varname>POINT</varname>.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>boolean <function>ST_EndPoint</function></funcdef>

			<paramdef><type>geometry </type> <parameter>g</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns the last point of a <varname>LINESTRING</varname> geometry
		as a <varname>POINT</varname> or <varname>NULL</varname> if the input
		parameter is not a <varname>LINESTRING</varname>.</para>

		<para>&sqlmm_compliant; SQL-MM 3: 7.1.4</para>
		<para>&Z_support;</para>

	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>postgis=# SELECT ST_AsText(ST_EndPoint('LINESTRING(1 1, 2 2, 3 3)'::geometry));
 st_astext
------------
 POINT(3 3)
(1 row)

postgis=# SELECT ST_EndPoint('POINT(1 1)'::geometry) IS NULL AS is_null;
  is_null
----------
 t
(1 row)

--3d endpoint
SELECT ST_AsEWKT(ST_EndPoint('LINESTRING(1 1 2, 1 2 3, 0 0 5)'));
  st_asewkt
--------------
 POINT(0 0 5)
(1 row)
</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_PointN" />, <xref
		linkend="ST_StartPoint" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_Envelope">
		  <refnamediv>
			<refname>ST_Envelope</refname>

			<refpurpose>Returns a geometry representing the double precision (float8) bounding box of the
			supplied geometry.</refpurpose>
		  </refnamediv>

		  <refsynopsisdiv>
			<funcsynopsis>
			  <funcprototype>
				<funcdef>geometry <function>ST_Envelope</function></funcdef>

				<paramdef><type>geometry </type> <parameter>g1</parameter></paramdef>
			  </funcprototype>
			</funcsynopsis>
		  </refsynopsisdiv>

		  <refsection>
			<title>Description</title>

			<para>Returns the float8 minimum bounding box for the supplied geometry, as a geometry.
			The polygon is defined by the corner points of the bounding box
			((<varname>MINX</varname>, <varname>MINY</varname>),
			(<varname>MINX</varname>, <varname>MAXY</varname>),
			(<varname>MAXX</varname>, <varname>MAXY</varname>),
			(<varname>MAXX</varname>, <varname>MINY</varname>),
			(<varname>MINX</varname>, <varname>MINY</varname>)). (PostGIS will add a
			<varname>ZMIN</varname>/<varname>ZMAX</varname> coordinate as
			well).</para>

			<para>Degenerate cases (vertical lines, points) will return a geometry of
			lower dimension than <varname>POLYGON</varname>, ie.
			<varname>POINT</varname> or <varname>LINESTRING</varname>.</para>

			<para>Availability: 1.5.0 behavior changed to output double precision instead of float4</para>
			<para>&sfs_compliant; s2.1.1.1</para>
			<para>&sqlmm_compliant; SQL-MM 3: 5.1.15</para>
		</refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>
SELECT ST_AsText(ST_Envelope('POINT(1 3)'::geometry));
 st_astext
------------
 POINT(1 3)
(1 row)


SELECT ST_AsText(ST_Envelope('LINESTRING(0 0, 1 3)'::geometry));
		   st_astext
--------------------------------
 POLYGON((0 0,0 3,1 3,1 0,0 0))
(1 row)


SELECT ST_AsText(ST_Envelope('POLYGON((0 0, 0 1, 1.0000001 1, 1.0000001 0, 0 0))'::geometry));
						  st_astext
--------------------------------------------------------------
 POLYGON((0 0,0 1,1.00000011920929 1,1.00000011920929 0,0 0))
(1 row)
SELECT ST_AsText(ST_Envelope('POLYGON((0 0, 0 1, 1.0000000001 1, 1.0000000001 0, 0 0))'::geometry));
						  st_astext
--------------------------------------------------------------
 POLYGON((0 0,0 1,1.00000011920929 1,1.00000011920929 0,0 0))
(1 row)
	
SELECT Box3D(geom), Box2D(geom), ST_AsText(ST_Envelope(geom)) As envelopewkt
	FROM (SELECT 'POLYGON((0 0, 0 1000012333334.34545678, 1.0000001 1, 1.0000001 0, 0 0))'::geometry As geom) As foo;

<!-- TODO: Fix examples to reflect new behavior -->
	</programlisting>
	  </refsection>
	  <refsection>
		<title>See Also</title>

		<para><xref linkend="Box2D" />, <xref linkend="Box3D" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_ExteriorRing">
	  <refnamediv>
		<refname>ST_ExteriorRing</refname>

		<refpurpose>Returns a line string representing the exterior ring of the <varname>POLYGON</varname> geometry. Return
				NULL if the geometry is not a polygon.  Will not work with MULTIPOLYGON</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>geometry <function>ST_ExteriorRing</function></funcdef>

			<paramdef><type>geometry </type> <parameter>a_polygon</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns a line string representing the exterior ring of the <varname>POLYGON</varname> geometry. Return
				NULL if the geometry is not a polygon.</para>

		<note><para>Only works with POLYGON geometry types</para></note>

		<para>&sfs_compliant; 2.1.5.1</para>
		<para>&sqlmm_compliant; SQL-MM 3: 8.2.3, 8.3.3</para>
                <para>&Z_support;</para>
	  </refsection>


	  <refsection>
		<title>Examples</title>
<programlisting>
--If you have a table of polygons
SELECT gid, ST_ExteriorRing(the_geom) AS ering
FROM sometable;

--If you have a table of MULTIPOLYGONs
--and want to return a MULTILINESTRING composed of the exterior rings of each polygon
SELECT gid, ST_Collect(ST_ExteriorRing(the_geom)) AS erings
	FROM (SELECT gid, (ST_Dump(the_geom)).geom As the_geom
			FROM sometable) As foo
GROUP BY gid;

--3d Example
SELECT ST_AsEWKT(
	ST_ExteriorRing(
	ST_GeomFromEWKT('POLYGON((0 0 1, 1 1 1, 1 2 1, 1 1 1, 0 0 1))')
	)
);

st_asewkt
---------
LINESTRING(0 0 1,1 1 1,1 2 1,1 1 1,0 0 1)
</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_Boundary" />, <xref linkend="ST_NumInteriorRings" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_GeometryN">
	  <refnamediv>
		<refname>ST_GeometryN</refname>

		<refpurpose>Return the 1-based Nth geometry if the geometry is a
			GEOMETRYCOLLECTION, MULTIPOINT, MULTILINESTRING, MULTICURVE or MULTIPOLYGON.
			Otherwise, return NULL.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>geometry <function>ST_GeometryN</function></funcdef>
			<paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
			<paramdef><type>integer </type> <parameter>n</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Return the 1-based Nth geometry if the geometry is a
			GEOMETRYCOLLECTION, MULTIPOINT, MULTILINESTRING, MULTICURVE or MULTIPOLYGON.
			Otherwise, return NULL.</para>

		<note>
		  <para>Index is 1-based as for OGC specs since version 0.8.0.
		  Previous versions implemented this as 0-based instead.</para>
		</note>

		<note>
		  <para>If you want to extract all geometries, of a geometry, ST_Dump is more efficient and will also work for singular geoms.</para>
		</note>

		<para>&sfs_compliant;</para>
                <para>&sqlmm_compliant; SQL-MM 3: 9.1.5</para>
                <para>&Z_support;</para>
                <para>&curve_support;</para>

	  </refsection>


	  <refsection>
		<title>Examples</title>

		<programlisting>
--Extracting a subset of points from a 3d multipoint
SELECT n, ST_AsEWKT(ST_GeometryN(the_geom, n)) As geomewkt
FROM (
VALUES (ST_GeomFromEWKT('MULTIPOINT(1 2 7, 3 4 7, 5 6 7, 8 9 10)') ),
( ST_GeomFromEWKT('MULTICURVE(CIRCULARSTRING(2.5 2.5,4.5 2.5, 3.5 3.5), (10 11, 12 11))') )
	)As foo(the_geom)
	CROSS JOIN generate_series(1,100) n
WHERE n &lt;= ST_NumGeometries(the_geom);

 n |               geomewkt
---+-----------------------------------------
 1 | POINT(1 2 7)
 2 | POINT(3 4 7)
 3 | POINT(5 6 7)
 4 | POINT(8 9 10)
 1 | CIRCULARSTRING(2.5 2.5,4.5 2.5,3.5 3.5)
 2 | LINESTRING(10 11,12 11)


--Extracting all geometries (useful when you want to assign an id)
SELECT gid, n, ST_GeometryN(the_geom, n)
FROM sometable CROSS JOIN generate_series(1,100) n
WHERE n &lt;= ST_NumGeometries(the_geom);


</programlisting>
	  </refsection>

	  <!-- Optionally add a "See Also" section -->
	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_Dump" />, <xref linkend="ST_NumGeometries" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_GeometryType">
		<refnamediv>
			<refname>ST_GeometryType</refname>
			<refpurpose>Return the geometry type of the ST_Geometry value.</refpurpose>
		</refnamediv>

		<refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>ST_GeometryType</function></funcdef>
			<paramdef><type>geometry </type> <parameter>g1</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
		</refsynopsisdiv>
		<refsection>
			<title>Description</title>

			<para>Returns the type of the geometry as a string. EG: 'ST_Linestring', 'ST_Polygon','ST_MultiPolygon' etc. This function differs from GeometryType(geometry) in the case of the string and ST in front that is returned, as well as the fact that it will not indicate whether the geometry is measured.</para>

		 	<para>&sqlmm_compliant;	SQL-MM 3: 5.1.4</para>

		</refsection>

		<refsection>
			<title>Examples</title>

			<programlisting>SELECT ST_GeometryType(ST_GeomFromText('LINESTRING(77.29 29.07,77.42 29.26,77.27 29.31,77.29 29.07)'));
			--result
			ST_LineString
			</programlisting>
		</refsection>
		<refsection>
			<title>See Also</title>

			<para><xref linkend="GeometryType" /></para>
		</refsection>
	</refentry>



	<refentry id="ST_InteriorRingN">
	  <refnamediv>
		<refname>ST_InteriorRingN</refname>

		<refpurpose>Return the Nth interior linestring ring of the polygon geometry.
			Return NULL if the geometry is not a polygon or the given N is out
			of range.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>geometry <function>ST_InteriorRingN</function></funcdef>
			<paramdef><type>geometry </type> <parameter>a_polygon</parameter></paramdef>
			<paramdef><type>integer </type> <parameter>n</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Return the Nth interior linestring ring of the polygon geometry.
			Return NULL if the geometry is not a polygon or the given N is out
			of range.  index starts at 1.</para>

		<!-- optionally mention that this function uses indexes if appropriate -->
		<note>
		  <para>This will not work for MULTIPOLYGONs.  Use in conjunction with ST_Dump for MULTIPOLYGONS</para>
		</note>

		<para>&sfs_compliant;</para>
		<para>&sqlmm_compliant; SQL-MM 3: 8.2.6, 8.3.5</para>
		<para>&Z_support;</para>

	  </refsection>


	  <refsection>
		<title>Examples</title>

		<programlisting>
SELECT ST_AsText(ST_InteriorRingN(the_geom, 1)) As the_geom
FROM (SELECT ST_BuildArea(
		ST_Collect(ST_Buffer(ST_Point(1,2), 20,3),
			ST_Buffer(ST_Point(1, 2), 10,3))) As the_geom
		)  as foo
		</programlisting>
	  </refsection>

	  <!-- Optionally add a "See Also" section -->
	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_BuildArea" />, <xref linkend="ST_Collect" />, <xref linkend="ST_Dump" />, <xref linkend="ST_NumInteriorRing" />, <xref linkend="ST_NumInteriorRings" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_IsClosed">
	  <refnamediv>
		<refname>ST_IsClosed</refname>

		<refpurpose>Returns <varname>TRUE</varname> if the
		<varname>LINESTRING</varname>'s start and end points are coincident.
		</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>boolean <function>ST_IsClosed</function></funcdef>

			<paramdef><type>geometry </type> <parameter>g</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns <varname>TRUE</varname> if the <varname>LINESTRING</varname>'s
		start and end points are coincident.</para>

		<para>&sfs_compliant;</para>
		<para>&sqlmm_compliant; SQL-MM 3: 7.1.5, 9.3.3</para>
		<note>
		  <para>SQL-MM defines the result of
		  <function>ST_IsClosed(<varname>NULL</varname>)</function> to be 0, while
		  PostGIS returns <varname>NULL</varname>.</para>
		</note>
		
		<para>&Z_support;</para>
		<para>&curve_support;</para>

	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>postgis=# SELECT ST_IsClosed('LINESTRING(0 0, 1 1)'::geometry);
 st_isclosed
-------------
 f
(1 row)

postgis=# SELECT ST_IsClosed('LINESTRING(0 0, 0 1, 1 1, 0 0)'::geometry);
 st_isclosed
-------------
 t
(1 row)

postgis=# SELECT ST_IsClosed('MULTILINESTRING((0 0, 0 1, 1 1, 0 0),(0 0, 1 1))'::geometry);
 st_isclosed
-------------
 f
(1 row)

postgis=# SELECT ST_IsClosed('POINT(0 0)'::geometry);
 st_isclosed
-------------
 t
(1 row)

postgis=# SELECT ST_IsClosed('MULTIPOINT((0 0), (1 1))'::geometry);
 st_isclosed
-------------
 t
(1 row)</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_IsRing" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_IsEmpty">
	  <refnamediv>
		<refname>ST_IsEmpty</refname>

		<refpurpose>Returns true if this Geometry is an empty geometry . If
				true, then this Geometry represents the empty point set - i.e.
				GEOMETRYCOLLECTION(EMPTY).</refpurpose>

	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>boolean <function>ST_IsEmpty</function></funcdef>
			<paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns true if this Geometry is an empty geometry . If
				true, then this Geometry represents an empty geometry collection, polygon, point etc.</para>
		<note>
			<para>SQL-MM defines the result of ST_IsEmpty(NULL) to be 0, while
			PostGIS returns NULL.</para>
		</note>

		<para>&sfs_compliant; s2.1.1.1</para>
		<para>&sqlmm_compliant; SQL-MM 3: 5.1.7</para>
		<para>&curve_support;</para>

	  </refsection>


	  <refsection>
		<title>Examples</title>

		<programlisting>
SELECT ST_IsEmpty('GEOMETRYCOLLECTION(EMPTY)');
 st_isempty
------------
 t
(1 row)

 SELECT ST_IsEmpty(ST_GeomFromText('POLYGON EMPTY'));
 st_isempty
------------
 t
(1 row)

SELECT ST_IsEmpty(ST_GeomFromText('POLYGON((1 2, 3 4, 5 6, 1 2))'));

 st_isempty
------------
 f
(1 row)

 SELECT ST_IsEmpty(ST_GeomFromText('POLYGON((1 2, 3 4, 5 6, 1 2))')) = false;
 ?column?
----------
 t
(1 row)

 SELECT ST_IsEmpty(ST_GeomFromText('CIRCULARSTRING EMPTY'));
  st_isempty
------------
 t
(1 row)


		</programlisting>
	  </refsection>

	</refentry>

  <refentry id="ST_IsRing">
	<refnamediv>
	  <refname>ST_IsRing</refname>

	  <refpurpose>Returns <varname>TRUE</varname> if this
	  <varname>LINESTRING</varname> is both closed and simple.</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
		<funcprototype>
		  <funcdef>boolean <function>ST_IsRing</function></funcdef>

		  <paramdef><type>geometry </type> <parameter>g</parameter></paramdef>
		</funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>

	<refsection>
	  <title>Description</title>

	  <para>Returns <varname>TRUE</varname> if this
	  <varname>LINESTRING</varname> is both <xref linkend="ST_IsClosed" />
	  (<function>ST_StartPoint(<parameter>g</parameter>)</function>
	  <function>~=</function>
	  <function>ST_Endpoint(<parameter>g</parameter>)</function>) and <xref
	  linkend="ST_IsSimple" /> (does not self intersect).</para>

	  <para>&sfs_compliant; 2.1.5.1</para>
	  <para>&sqlmm_compliant; SQL-MM 3: 7.1.6</para>
	  <note>
		<para>SQL-MM defines the result of
		<function>ST_IsRing(<varname>NULL</varname>)</function> to be 0, while
		PostGIS returns <varname>NULL</varname>.</para>
	  </note>
	</refsection>

	<refsection>
	  <title>Examples</title>

	  <programlisting>SELECT ST_IsRing(the_geom), ST_IsClosed(the_geom), ST_IsSimple(the_geom)
FROM (SELECT 'LINESTRING(0 0, 0 1, 1 1, 1 0, 0 0)'::geometry AS the_geom) AS foo;
 st_isring | st_isclosed | st_issimple
-----------+-------------+-------------
 t         | t           | t
(1 row)

SELECT ST_IsRing(the_geom), ST_IsClosed(the_geom), ST_IsSimple(the_geom)
FROM (SELECT 'LINESTRING(0 0, 0 1, 1 0, 1 1, 0 0)'::geometry AS the_geom) AS foo;
 st_isring | st_isclosed | st_issimple
-----------+-------------+-------------
 f         | t           | f
(1 row)</programlisting>
	</refsection>

	<refsection>
	  <title>See Also</title>

	  <para><xref linkend="ST_IsClosed" />, <xref linkend="ST_IsSimple" />, <xref linkend="ST_StartPoint" />,
	  <xref linkend="ST_EndPoint" /></para>
	</refsection>
  </refentry>


  <refentry id="ST_IsSimple">
	  <refnamediv>
		<refname>ST_IsSimple</refname>

		<refpurpose>Returns (TRUE) if this Geometry has no anomalous geometric
				points, such as self intersection or self tangency.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>boolean <function>ST_IsSimple</function></funcdef>
			<paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns true if this Geometry has no anomalous geometric
				points, such as self intersection or self tangency. For more
			information on the OGC's definition of geometry simplicity and validity, refer
			to <link linkend="OGC_Validity">"Ensuring OpenGIS compliancy of geometries"</link></para>

		<note>
			<para>SQL-MM defines the result of ST_IsSimple(NULL) to be 0,
			while PostGIS returns NULL.</para>
		</note>

		<para>&sfs_compliant; s2.1.1.1</para>
		<para>&sqlmm_compliant; SQL-MM 3: 5.1.8</para>
		<para>&Z_support;</para>

	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting> SELECT ST_IsSimple(ST_GeomFromText('POLYGON((1 2, 3 4, 5 6, 1 2))'));
 st_issimple
-------------
 t
(1 row)

 SELECT ST_IsSimple(ST_GeomFromText('LINESTRING(1 1,2 2,2 3.5,1 3,1 2,2 1)'));
 st_issimple
-------------
 f
(1 row)</programlisting>
		</refsection>

		<refsection>
			<title>See Also</title>

			<para><xref linkend="ST_IsValid" /></para>
		</refsection>
	</refentry>

	<refentry id="ST_IsValid">
	  <refnamediv>
		<refname>ST_IsValid</refname>

		<refpurpose>Returns <varname>true</varname> if the
		<varname>ST_Geometry</varname> is well formed.
		</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>boolean <function>ST_IsValid</function></funcdef>

			<paramdef><type>geometry </type> <parameter>g</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Test if an ST_Geometry value is well formed.  For geometries that are invalid,
			the PostgreSQL NOTICE will provide details of why it is not valid.  For more
			information on the OGC's definition of geometry simplicity and validity, refer
			to <link linkend="OGC_Validity">"Ensuring OpenGIS compliancy of geometries"</link></para>
		<note>
			<para>SQL-MM defines the result of ST_IsValid(NULL) to be 0, while
			PostGIS returns NULL.</para>
		</note>

		<para>&sfs_compliant;</para>
		<para>&sqlmm_compliant; SQL-MM 3: 5.1.9</para>

	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT ST_IsValid(ST_GeomFromText('LINESTRING(0 0, 1 1)')) As good_line,
	ST_IsValid(ST_GeomFromText('POLYGON((0 0, 1 1, 1 2, 1 1, 0 0))')) As bad_poly
--results
NOTICE:  Self-intersection at or near point 0 0
 good_line | bad_poly
-----------+----------
 t         | f
</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_IsSimple" />, <xref linkend="ST_IsValidReason" />, <xref linkend="ST_Summary" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_IsValidReason">
	  <refnamediv>
		<refname>ST_IsValidReason</refname>

		<refpurpose>Returns text stating if a geometry is valid or not and if not valid, a reason why.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>ST_IsValidReason</function></funcdef>
			<paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns text stating if a geometry is valid or not an if not valid, a reason why.</para>

		<para>Useful in combination with ST_IsValid to generate a detailed report of invalid geometries and reasons.</para>
		<para>Availability: 1.4 - requires GEOS &gt;= 3.1.0.</para>

	  </refsection>


	  <refsection>
		<title>Examples</title>

		<programlisting>
--First 3 Rejects from a successful quintuplet experiment
SELECT gid, ST_IsValidReason(the_geom) as validity_info
FROM
(SELECT ST_MakePolygon(ST_ExteriorRing(e.buff), ST_Accum(f.line)) As the_geom, gid
FROM (SELECT ST_Buffer(ST_MakePoint(x1*10,y1), z1) As buff, x1*10 + y1*100 + z1*1000 As gid
	FROM generate_series(-4,6) x1
	CROSS JOIN generate_series(2,5) y1
	CROSS JOIN generate_series(1,8) z1
	WHERE x1 &gt; y1*0.5 AND z1 &lt; x1*y1) As e
	INNER JOIN (SELECT ST_Translate(ST_ExteriorRing(ST_Buffer(ST_MakePoint(x1*10,y1), z1)),y1*1, z1*2) As line
	FROM generate_series(-3,6) x1
	CROSS JOIN generate_series(2,5) y1
	CROSS JOIN generate_series(1,10) z1
	WHERE x1 &gt; y1*0.75 AND z1 &lt; x1*y1) As f
ON (ST_Area(e.buff) &gt; 78 AND ST_Contains(e.buff, f.line))
GROUP BY gid, e.buff) As quintuplet_experiment
WHERE ST_IsValid(the_geom) = false
ORDER BY gid
LIMIT 3;

 gid  |      validity_info
------+--------------------------
 5330 | Self-intersection [32 5]
 5340 | Self-intersection [42 5]
 5350 | Self-intersection [52 5]

 --simple example
SELECT ST_IsValidReason('LINESTRING(220227 150406,2220227 150407,222020 150410)');

 st_isvalidreason
------------------
 Valid Geometry

		</programlisting>
	  </refsection>

	  <!-- Optionally add a "See Also" section -->
	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_IsValid" />, <xref linkend="ST_Summary" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_M">
	  <refnamediv>
		<refname>ST_M</refname>

		<refpurpose>Return the M coordinate of the point, or NULL if not
			available. Input must be a point.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>float <function>ST_M</function></funcdef>
			<paramdef><type>geometry </type> <parameter>a_point</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Return the M coordinate of the point, or NULL if not
			available. Input must be a point.</para>

		<note>
			  <para>This is not (yet) part of the OGC spec, but is listed here
			  to complete the point coordinate extractor function list.</para>
		</note>
		<para>&sfs_compliant;</para>
		<para>&sqlmm_compliant;</para>
		<para>&Z_support;</para>

	  </refsection>


	  <refsection>
		<title>Examples</title>
		<programlisting>SELECT ST_M(ST_GeomFromEWKT('POINT(1 2 3 4)'));
 st_m
------
	4
(1 row)

		</programlisting>
	  </refsection>

	  <!-- Optionally add a "See Also" section -->
	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_GeomFromEWKT" />, <xref linkend="ST_X" />, <xref linkend="ST_Y" />, <xref linkend="ST_Z" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_NDims">
		<refnamediv>
			<refname>ST_NDims</refname>
			<refpurpose>Returns coordinate dimension of the geometry as a small int.
			Values are: 2,3 or 4.</refpurpose>
		</refnamediv>

		<refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>integer <function>ST_NDims</function></funcdef>
			<paramdef><type>geometry </type> <parameter>g1</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
		</refsynopsisdiv>

		<refsection>
			<title>Description</title>

			<para>Returns the coordinate dimension of the geometry.  PostGIS supports 2 -  (x,y) ,
			3 -  (x,y,z) or 2D with measure - x,y,m, and 4 - 3D with measure space x,y,z,m</para>

			<para>&Z_support;</para>
		</refsection>

		<refsection>
			<title>Examples</title>

			<programlisting>SELECT ST_NDims(ST_GeomFromText('POINT(1 1)')) As d2point,
	ST_NDims(ST_GeomFromEWKT('POINT(1 1 2)')) As d3point,
	ST_NDims(ST_GeomFromEWKT('POINTM(1 1 0.5)')) As d2pointm;

	 d2point | d3point | d2pointm
---------+---------+----------
	   2 |       3 |        3
			</programlisting>
		</refsection>
		<refsection>
			<title>See Also</title>
			<para><xref linkend="ST_CoordDim" />, <xref linkend="ST_Dimension" />, <xref linkend="ST_GeomFromEWKT" /></para>
		</refsection>
	</refentry>

	<refentry id="ST_NPoints">
		<refnamediv>
			<refname>ST_NPoints</refname>
			<refpurpose>Return the number of points (vertexes) in a geometry.</refpurpose>
		</refnamediv>

		<refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>integer <function>ST_NPoints</function></funcdef>
			<paramdef><type>geometry </type> <parameter>g1</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
		</refsynopsisdiv>

		<refsection>
			<title>Description</title>

			<para>Return the number of points in a geometry.  Works for all geometries.</para>
			<note><para>Prior to 1.3.4, this function crashes if used with geometries that contain CURVES.  This is fixed in 1.3.4+</para></note>
			<para>&Z_support;</para>
			<para>&curve_support;</para>

		</refsection>

		<refsection>
			<title>Examples</title>

<programlisting>SELECT ST_NPoints(ST_GeomFromText('LINESTRING(77.29 29.07,77.42 29.26,77.27 29.31,77.29 29.07)'));
--result
4

--Polygon in 3D space
SELECT ST_NPoints(ST_GeomFromEWKT('LINESTRING(77.29 29.07 1,77.42 29.26 0,77.27 29.31 -1,77.29 29.07 3)'))
--result
4</programlisting>
		</refsection>
		<refsection>
			<title>See Also</title>

			<para><xref linkend="ST_NumPoints" /></para>
		</refsection>
	</refentry>

	<refentry id="ST_NRings">
	  <refnamediv>
		<refname>ST_NRings</refname>
		<refpurpose>If the geometry is a polygon or multi-polygon returns the number of rings.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>integer <function>ST_NRings</function></funcdef>
			<paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>If the geometry is a polygon or multi-polygon returns the number of rings.  Unlike NumInteriorRings, it counts
		the outer rings as well.</para>
		<para>&Z_support;</para>
		<para>&curve_support;</para>

	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT ST_NRings(the_geom) As Nrings, ST_NumInteriorRings(the_geom) As ninterrings
					FROM (SELECT ST_GeomFromText('POLYGON((1 2, 3 4, 5 6, 1 2))') As the_geom) As foo;
	 nrings | ninterrings
--------+-------------
	  1 |           0
(1 row)
</programlisting>
	  </refsection>

	  <!-- Optionally add a "See Also" section -->
	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_NumInteriorRings" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_NumGeometries">
		<refnamediv>
			<refname>ST_NumGeometries</refname>
			<refpurpose>If geometry is a GEOMETRYCOLLECTION (or MULTI*) return the
			number of geometries, otherwise return NULL.</refpurpose>
		</refnamediv>

		<refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>integer <function>ST_NumGeometries</function></funcdef>
			<paramdef><type>geometry </type> <parameter>a_multi_or_geomcollection</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
		</refsynopsisdiv>

		<refsection>
			<title>Description</title>

			<para>Returns the number of Geometries. If geometry is a GEOMETRYCOLLECTION (or MULTI*) return the
			number of geometries, otherwise return NULL.</para>

			<para>&sqlmm_compliant; SQL-MM 3: 9.1.4</para>

		</refsection>

		<refsection>
			<title>Examples</title>

<programlisting>
--Although ST_NumGeometries will return null when passed a single, you can wrap in ST_Multi to force 1 or more for all geoms
SELECT ST_NumGeometries(ST_Multi(ST_GeomFromText('LINESTRING(77.29 29.07,77.42 29.26,77.27 29.31,77.29 29.07)')));
--result
1

--Geometry Collection Example - multis count as one geom in a collection
SELECT ST_NumGeometries(ST_GeomFromEWKT('GEOMETRYCOLLECTION(MULTIPOINT(-2 3 , -2 2),
LINESTRING(5 5 ,10 10),
POLYGON((-7 4.2,-7.1 5,-7.1 4.3,-7 4.2)))'));
--result
3
</programlisting>
		</refsection>
		<refsection>
			<title>See Also</title>

			<para><xref linkend="ST_GeometryN" />, <xref linkend="ST_Multi" /></para>
		</refsection>
	</refentry>

	<refentry id="ST_NumInteriorRings">
	  <refnamediv>
		<refname>ST_NumInteriorRings</refname>
		<refpurpose>Return the number of interior rings of the first polygon in
			the geometry. This will work with both POLYGON and MULTIPOLYGON types but only looks at the first polygon.
			Return NULL if there is no polygon in the
			geometry.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>integer <function>ST_NumInteriorRings</function></funcdef>
			<paramdef><type>geometry </type> <parameter>a_polygon</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Return the number of interior rings of the first polygon in
			the geometry. This will work with both POLYGON and MULTIPOLYGON types but only looks at the first polygon.
			Return NULL if there is no polygon in the
			geometry.</para>

		<para>&sqlmm_compliant; SQL-MM 3: 8.2.5</para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

			<programlisting>
--If you have a regular polygon
SELECT gid, field1, field2, ST_NumInteriorRings(the_geom) AS numholes
FROM sometable;

--If you have multipolygons
--And you want to know the total number of interior rings in the MULTIPOLYGON
SELECT gid, field1, field2, SUM(ST_NumInteriorRings(the_geom)) AS numholes
FROM (SELECT gid, field1, field2, (ST_Dump(the_geom)).geom As the_geom
	FROM sometable) As foo
GROUP BY gid, field1,field2;
			</programlisting>
	  </refsection>
	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_NumInteriorRing" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_NumInteriorRing">
	  <refnamediv>
		<refname>ST_NumInteriorRing</refname>
		<refpurpose>Return the number of interior rings of the first polygon in
			the geometry. Synonym to ST_NumInteriorRings. </refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>integer <function>ST_NumInteriorRing</function></funcdef>
			<paramdef><type>geometry </type> <parameter>a_polygon</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Return the number of interior rings of the first polygon in
			the geometry. Synonym to ST_NumInteriorRings. The OpenGIS specs are
			ambiguous about the exact function naming, so we provide both
			spellings.</para>

		<para>&sqlmm_compliant; SQL-MM 3: 8.2.5</para>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_NumInteriorRings" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_NumPoints">
	  <refnamediv>
		<refname>ST_NumPoints</refname>
		<refpurpose>Return the number of points in an ST_LineString or
		  ST_CircularString value.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>integer <function>ST_NumPoints</function></funcdef>
			<paramdef><type>geometry </type> <parameter>g1</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Return the number of points in an ST_LineString or
		  ST_CircularString value. Prior to 1.4 only works with Linestrings as the specs state.  From 1.4 forward this is an alias for ST_NPoints which returns number of vertexes for
		  not just line strings.
		  Consider using ST_NPoints instead which is multi-purpose
		  and works with many geometry types.</para>

		<para>&sfs_compliant;</para>
		<para>&sqlmm_compliant; SQL-MM 3: 7.2.4</para>
	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT ST_NumPoints(ST_GeomFromText('LINESTRING(77.29 29.07,77.42 29.26,77.27 29.31,77.29 29.07)'));
		--result
		4
		</programlisting>
	  </refsection>
	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_NPoints" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_PointN">
	  <refnamediv>
		<refname>ST_PointN</refname>

		<refpurpose>Return the Nth point in the first linestring or circular linestring in the
			geometry. Return NULL if there is no linestring in the
			geometry.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>geometry <function>ST_PointN</function></funcdef>
			<paramdef><type>geometry </type> <parameter>a_linestring</parameter></paramdef>
			<paramdef><type>integer </type> <parameter>n</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Return the Nth point in the first linestring or circular linestring in the
			geometry. Return NULL if there is no linestring in the
			geometry.</para>

		<note>
			  <para>Index is 1-based as for OGC specs since version 0.8.0.
			  Previous versions implemented this as 0-based instead.</para>
		</note>

		<note>
			  <para>If you want to get the nth point of each line string in a multilinestring, use in conjunction
			  with ST_Dump</para>
		</note>

		<para>&sfs_compliant;</para>
		<para>&sqlmm_compliant; SQL-MM 3: 7.2.5, 7.3.5</para>
		<para>&Z_support;</para>
		<para>&curve_support;</para>

	  </refsection>


	  <refsection>
		<title>Examples</title>

		<programlisting>-- Extract all POINTs from a LINESTRING
SELECT ST_AsText(
   ST_PointN(
	  column1,
	  generate_series(1, ST_NPoints(column1))
   ))
FROM ( VALUES ('LINESTRING(0 0, 1 1, 2 2)'::geometry) ) AS foo;

 st_astext
------------
 POINT(0 0)
 POINT(1 1)
 POINT(2 2)
(3 rows)

--Example circular string
SELECT ST_AsText(ST_PointN(ST_GeomFromText('CIRCULARSTRING(1 2, 3 2, 1 2)'),2));

st_astext
----------
POINT(3 2)
</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_NPoints" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_SRID">
	  <refnamediv>
		<refname>ST_SRID</refname>
		<refpurpose>Returns the spatial reference identifier for the ST_Geometry as defined in spatial_ref_sys table.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>integer <function>ST_SRID</function></funcdef>
			<paramdef><type>geometry </type> <parameter>g1</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns the spatial reference identifier for the ST_Geometry as defined in <xref linkend="spatial_ref_sys">spatial_ref_sys</xref> table. </para>
		<para><note><para>spatial_ref_sys
		table is a table that catalogs all spatial reference systems known to PostGIS and is used for transformations from one spatial
			reference system to another.  So verifying you have the right spatial reference system identifier is important if you plan to ever transform your geometries.</para></note></para>
		<para>&sfs_compliant; s2.1.1.1</para>
		<para>&sqlmm_compliant; SQL-MM 3: 5.1.5</para>
		<para>&curve_support;</para>

	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT ST_SRID(ST_GeomFromText('POINT(-71.1043 42.315)',4326));
		--result
		4326
		</programlisting>
	  </refsection>
	  <refsection>
		<title>See Also</title>

		<para><xref linkend="spatial_ref_sys" />,<xref linkend="ST_GeomFromText" />, <xref linkend="ST_SetSRID" />, <xref linkend="ST_Transform" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_StartPoint">
	<refnamediv>
	  <refname>ST_StartPoint</refname>

	  <refpurpose>Returns the first point of a <varname>LINESTRING</varname>
	  geometry as a <varname>POINT</varname>.</refpurpose>
	</refnamediv>

	<refsynopsisdiv>
	  <funcsynopsis>
		<funcprototype>
		  <funcdef>geometry <function>ST_StartPoint</function></funcdef>

		  <paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
		</funcprototype>
	  </funcsynopsis>
	</refsynopsisdiv>

	<refsection>
	  <title>Description</title>

	  <para>Returns the first point of a <varname>LINESTRING</varname> geometry
	  as a <varname>POINT</varname> or <varname>NULL</varname> if the input
	  parameter is not a <varname>LINESTRING</varname>.</para>

	  <para>&sqlmm_compliant; SQL-MM 3: 7.1.3</para>
	  <para>&Z_support;</para>

	</refsection>

	<refsection>
	  <title>Examples</title>

	  <programlisting>SELECT ST_AsText(ST_StartPoint('LINESTRING(0 1, 0 2)'::geometry));
 st_astext
------------
 POINT(0 1)
(1 row)

SELECT ST_StartPoint('POINT(0 1)'::geometry) IS NULL AS is_null;
  is_null
----------
 t
(1 row)

--3d line
SELECT ST_AsEWKT(ST_StartPoint('LINESTRING(0 1 1, 0 2 2)'::geometry));
 st_asewkt
------------
 POINT(0 1 1)
(1 row)

</programlisting>
	</refsection>

	<refsection>
	  <title>See Also</title>

	  <para><xref linkend="ST_EndPoint" />, <xref linkend="ST_PointN" /></para>
	</refsection>
  </refentry>
	<refentry id="ST_Summary">
	  <refnamediv>
		<refname>ST_Summary</refname>

		<refpurpose>Returns a text summary of the contents of the
		<varname>ST_Geometry</varname>.
		</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>text <function>ST_Summary</function></funcdef>

			<paramdef><type>geometry </type> <parameter>g</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns a text summary of the contents of the geometry.</para>
		<para>&Z_support;</para>

	  </refsection>

	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT ST_Summary(ST_GeomFromText('LINESTRING(0 0, 1 1)')) As good_line,
	ST_Summary(ST_GeomFromText('POLYGON((0 0, 1 1, 1 2, 1 1, 0 0))')) As bad_poly
--results
	  good_line       |        bad_poly
----------------------+-------------------------
					  |
Line[B] with 2 points : Polygon[B] with 1 rings
					  :    ring 0 has 5 points
					  :

--3d polygon
SELECT ST_Summary(ST_GeomFromEWKT('LINESTRING(0 0 1, 1 1 1)')) As good_line,
	ST_Summary(ST_GeomFromEWKT('POLYGON((0 0 1, 1 1 2, 1 2 3, 1 1 1, 0 0 1))')) As poly

--results
	  good_line       |        poly
----------------------+-------------------------
					  |
Line[ZB] with 2 points : Polygon[ZB] with 1 rings
					  :    ring 0 has 5 points
					  :

</programlisting>
	  </refsection>

	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_IsValid" />, <xref linkend="ST_IsValidReason" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_X">
	  <refnamediv>
		<refname>ST_X</refname>

		<refpurpose>Return the X coordinate of the point, or NULL if not
			available. Input must be a point.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>float <function>ST_X</function></funcdef>
			<paramdef><type>geometry </type> <parameter>a_point</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Return the X coordinate of the point, or NULL if not
			available. Input must be a point.</para>

		<note><para>If you want to get the max min x values of any geometry look at ST_XMin, ST_XMax functions.</para></note>

		<para>&sqlmm_compliant; SQL-MM 3: 6.1.3</para>
		<para>&Z_support;</para>

	  </refsection>


	  <refsection>
		<title>Examples</title>
		<programlisting>SELECT ST_X(ST_GeomFromEWKT('POINT(1 2 3 4)'));
 st_x
------
	1
(1 row)

SELECT ST_Y(ST_Centroid(ST_GeomFromEWKT('LINESTRING(1 2 3 4, 1 1 1 1)')));
 st_y
------
  1.5
(1 row)

		</programlisting>
	  </refsection>

	  <!-- Optionally add a "See Also" section -->
	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_Centroid" />, <xref linkend="ST_GeomFromEWKT" />, <xref linkend="ST_M" />, <xref linkend="ST_XMax" />, <xref linkend="ST_XMin" />, <xref linkend="ST_Y" />, <xref linkend="ST_Z" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_Y">
	  <refnamediv>
		<refname>ST_Y</refname>

		<refpurpose>Return the Y coordinate of the point, or NULL if not
			available. Input must be a point.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>float <function>ST_Y</function></funcdef>
			<paramdef><type>geometry </type> <parameter>a_point</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Return the Y coordinate of the point, or NULL if not
			available. Input must be a point.</para>

		<para>&sfs_compliant;</para>
		<para>&sqlmm_compliant; SQL-MM 3: 6.1.4</para>
		<para>&Z_support;</para>

	  </refsection>


	  <refsection>
		<title>Examples</title>
		<programlisting>SELECT ST_Y(ST_GeomFromEWKT('POINT(1 2 3 4)'));
 st_y
------
	2
(1 row)

SELECT ST_Y(ST_Centroid(ST_GeomFromEWKT('LINESTRING(1 2 3 4, 1 1 1 1)')));
 st_y
------
  1.5
(1 row)


		</programlisting>
	  </refsection>

	  <!-- Optionally add a "See Also" section -->
	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_Centroid" />, <xref linkend="ST_GeomFromEWKT" />, <xref linkend="ST_M" />, <xref linkend="ST_X" />, <xref linkend="ST_YMax" />, <xref linkend="ST_YMin" />, <xref linkend="ST_Z" /></para>
	  </refsection>
	</refentry>

	<refentry id="ST_Z">
	  <refnamediv>
		<refname>ST_Z</refname>

		<refpurpose>Return the Z coordinate of the point, or NULL if not
			available. Input must be a point.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>float <function>ST_Z</function></funcdef>
			<paramdef><type>geometry </type> <parameter>a_point</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Return the Z coordinate of the point, or NULL if not
			available. Input must be a point.</para>



		<para>&sqlmm_compliant;</para>
		<para>&Z_support;</para>
	  </refsection>


	  <refsection>
		<title>Examples</title>
		<programlisting>SELECT ST_Z(ST_GeomFromEWKT('POINT(1 2 3 4)'));
 st_z
------
	3
(1 row)

		</programlisting>
	  </refsection>

	  <!-- Optionally add a "See Also" section -->
	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_GeomFromEWKT" />, <xref linkend="ST_M" />, <xref linkend="ST_X" />, <xref linkend="ST_Y" />, <xref linkend="ST_ZMax" />, <xref linkend="ST_ZMin" /> </para>
	  </refsection>
	</refentry>

	<refentry id="ST_Zmflag">
	  <refnamediv>
		<refname>ST_Zmflag</refname>

		<refpurpose>Returns ZM (dimension semantic) flag of the geometries as a
			small int. Values are: 0=2d, 1=3dm, 2=3dz, 3=4d.</refpurpose>
	  </refnamediv>

	  <refsynopsisdiv>
		<funcsynopsis>
		  <funcprototype>
			<funcdef>smallint <function>ST_Zmflag</function></funcdef>
			<paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
		  </funcprototype>
		</funcsynopsis>
	  </refsynopsisdiv>

	  <refsection>
		<title>Description</title>

		<para>Returns ZM (dimension semantic) flag of the geometries as a
			small int. Values are: 0=2d, 1=3dm, 2=3dz, 3=4d.</para>

		<para>&Z_support;</para>
		<para>&curve_support;</para>
	  </refsection>


	  <refsection>
		<title>Examples</title>

		<programlisting>SELECT ST_Zmflag(ST_GeomFromEWKT('LINESTRING(1 2, 3 4)'));
 st_zmflag
-----------
		 0

SELECT ST_Zmflag(ST_GeomFromEWKT('LINESTRINGM(1 2 3, 3 4 3)'));
 st_zmflag
-----------
		 1

SELECT ST_Zmflag(ST_GeomFromEWKT('CIRCULARSTRING(1 2 3, 3 4 3, 5 6 3)'));
 st_zmflag
-----------
		 2
SELECT ST_Zmflag(ST_GeomFromEWKT('POINT(1 2 3 4)'));
 st_zmflag
-----------
		 3
</programlisting>
	  </refsection>

	  <!-- Optionally add a "See Also" section -->
	  <refsection>
		<title>See Also</title>

		<para><xref linkend="ST_CoordDim" />, <xref linkend="ST_NDims" />, <xref linkend="ST_Dimension" /></para>
	  </refsection>
	</refentry>


  </sect1>