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
|
<!-- Converted by db4-upgrade version 1.1 -->
<section xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="PostGIS_Types">
<title>PostGIS Geometry/Geography/Box Data Types</title><info>
<abstract>
<para>This section lists the custom PostgreSQL
data types installed by PostGIS to represent spatial data.
</para>
<para>Each data type describes its type casting behavior.
A <link xlink:href="https://www.postgresql.org/docs/current/sql-expressions.html#SQL-SYNTAX-TYPE-CASTS">type cast</link>
converts values of one data type into another type.
PostgreSQL allows defining casting behavior for custom types, along with the functions used to convert type values.
Casts can have <emphasis role="bold">automatic</emphasis> behavior,
which allows automatic conversion of a function argument to a type supported by the function.</para>
<para>
Some casts have <emphasis role="bold">explicit</emphasis> behavior,
which means the cast must be specified using the syntax <varname>CAST(myval As sometype)</varname>
or <varname>myval::sometype</varname>.
Explicit casting avoids the issue of ambiguous casts,
which can occur when using an overloaded function which does not support a given type.
For example, a function may accept a box2d or a box3d, but not a geometry.
Since geometry has an automatic cast to both box types, this produces an "ambiguous function" error.
To prevent the error use an explicit cast to the desired box type.</para>
<para>All data types can be cast to <varname>text</varname>, so this does not need to be specified explicitly.</para>
</abstract>
</info>
<refentry xml:id="box2d_type">
<refnamediv>
<refname>box2d</refname>
<refpurpose>The type representing a 2-dimensional bounding box. </refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para><varname>box2d</varname> is a spatial data type used to represent
the two-dimensional bounding box enclosing a geometry or collection of geometries.
For example, the <xref linkend="ST_Extent"/> aggregate function returns a <varname>box2d</varname> object.</para>
<para>The representation contains the values <varname>xmin, ymin, xmax, ymax</varname>.
These are the minimum and maximum values of the X and Y extents.
</para>
<para><varname>box2d</varname> objects have a text representation which looks like <code>BOX(1 2,5 6)</code>.
</para>
</refsection>
<refsection>
<title>Casting Behavior</title>
<para>This table lists the automatic and explicit casts allowed for this data type:</para>
<informaltable rowsep="1" frame="all">
<tgroup cols="2">
<tbody>
<row>
<entry>Cast To</entry> <entry>Behavior</entry>
</row>
<row>
<entry>box3d</entry> <entry>automatic</entry>
</row>
<row>
<entry>geometry</entry> <entry>automatic</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsection>
<refsection>
<title>See Also</title>
<para><xref linkend="PostGIS_BoxFunctions"/></para>
</refsection>
</refentry>
<refentry xml:id="box3d_type">
<refnamediv>
<refname>box3d</refname>
<refpurpose>The type representing a 3-dimensional bounding box. </refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para><varname>box3d</varname> is a PostGIS spatial data type used to represent
the three-dimensional bounding box enclosing a geometry or collection of geometries.
For example, the <xref linkend="ST_3DExtent"/> aggregate function returns a <varname>box3d</varname> object.
</para>
<para>The representation contains the values <varname>xmin, ymin, zmin, xmax, ymax, zmax</varname>.
These are the minimum and maximum values of the X, Y and Z extents.
</para>
<para><varname>box3d</varname> objects have a text representation which looks like <code>BOX3D(1 2 3,5 6 5)</code>.
</para>
</refsection>
<refsection>
<title>Casting Behavior</title>
<para>This table lists the automatic and explicit casts allowed for this data type:</para>
<informaltable rowsep="1" frame="all">
<tgroup cols="2">
<tbody>
<row>
<entry>Cast To</entry>
<entry>Behavior</entry>
</row>
<row>
<entry>box</entry>
<entry>automatic</entry>
</row>
<row>
<entry>box2d</entry>
<entry>automatic</entry>
</row>
<row>
<entry>geometry</entry>
<entry>automatic</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsection>
<refsection>
<title>See Also</title>
<para><xref linkend="PostGIS_BoxFunctions"/></para>
</refsection>
</refentry>
<refentry xml:id="geometry">
<refnamediv>
<refname>geometry</refname>
<refpurpose>The type representing spatial features with planar coordinate systems.</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para><varname>geometry</varname> is a fundamental PostGIS spatial data type used to represent a feature in planar (Euclidean) coordinate systems.</para>
<para>All spatial operations on geometry use the units of the Spatial Reference System the geometry is in.</para>
</refsection>
<refsection>
<title>Casting Behavior</title>
<para>This table lists the automatic and explicit casts allowed for this data type:</para>
<informaltable rowsep="1" frame="all">
<tgroup cols="2">
<tbody>
<row>
<entry>Cast To</entry>
<entry>Behavior</entry>
</row>
<row>
<entry>box</entry>
<entry>automatic</entry>
</row>
<row>
<entry>box2d</entry>
<entry>automatic</entry>
</row>
<row>
<entry>box3d</entry>
<entry>automatic</entry>
</row>
<row>
<entry>bytea</entry>
<entry>automatic</entry>
</row>
<row>
<entry>geography</entry>
<entry>automatic</entry>
</row>
<row>
<entry>text</entry>
<entry>automatic</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsection>
<refsection>
<title>See Also</title>
<para><xref linkend="RefObject"/>, <xref linkend="PostGIS_SQLMM_Functions"/></para>
</refsection>
</refentry>
<refentry xml:id="geometry_dump">
<refnamediv>
<refname>geometry_dump</refname>
<refpurpose>A composite type used to describe the parts of complex geometry.</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para><varname>geometry_dump</varname> is a
<link xlink:href="https://www.postgresql.org/docs/current/rowtypes.html">composite data type</link>
containing the fields:</para>
<itemizedlist>
<listitem>
<para><varname>geom</varname> - a geometry representing a component of the dumped geometry.
The geometry type depends on the originating function.</para>
</listitem>
<listitem>
<para><varname>path[]</varname> - an integer array
that defines the navigation path within the dumped geometry to the <varname>geom</varname> component.
The path array is 1-based (i.e. <varname>path[1]</varname> is the first element.)</para>
</listitem>
</itemizedlist>
<para>
It is used by the <varname>ST_Dump*</varname> family of functions as an output type to explode a complex geometry into its
constituent parts.</para>
</refsection>
<refsection>
<title>See Also</title>
<para><xref linkend="PostGIS_Geometry_DumpFunctions"/> </para>
</refsection>
</refentry>
<refentry xml:id="geography">
<refnamediv>
<refname>geography</refname>
<refpurpose>The type representing spatial features with geodetic (ellipsoidal) coordinate systems.</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para><varname>geography</varname> is a spatial data type used to represent a feature in geodetic coordinate systems.
Geodetic coordinate systems model the earth using an ellipsoid.
</para>
<para>
Spatial operations on the geography type provide more accurate results
by taking the ellipsoidal model into account.
</para>
</refsection>
<refsection>
<title>Casting Behavior</title>
<para>This table lists the automatic and explicit casts allowed for this data type:</para>
<informaltable rowsep="1" frame="all">
<tgroup cols="2">
<tbody>
<row>
<entry>Cast To</entry>
<entry>Behavior</entry>
</row>
<row>
<entry>geometry</entry>
<entry>explicit</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsection>
<refsection>
<title>See Also</title>
<para><xref linkend="PostGIS_Geography"/>, <xref linkend="PostGIS_GeographyFunctions"/></para>
</refsection>
</refentry>
</section>
|