postgis/doc/reference_type.xml
Nicklas Avén 517bd984db Renaming of 3D functions, #817
git-svn-id: http://svn.osgeo.org/postgis/trunk@6974 b70326c6-7e19-0410-871a-916f4a2858ee
2011-03-27 17:50:58 +00:00

289 lines
9.5 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<sect1 id="PostGIS_Types">
<sect1info>
<abstract>
<para>This section lists the PostgreSQL data types installed by PostGIS. Note we describe the casting behavior of these which is very
important especially when designing your own functions.
</para>
<para>A Cast is when one type is coerced into another type. PostgreSQL
is unique from most databases in that it allows you to define casting behavior for custom types and the functions used for casting.
A cast can be specified as automatic in which case, you do not have to do a CAST(myfoo As otherfootype) or myfoo::otherfootype
if you are feeding it to a function that only works with otherfootype and there is an automatic cast in place for it.
</para>
<para>The danger of relying on automatic cast behavior is when you have an overloaded function say one that takes a box2d and one that takes a box3d
but no geometry. What happens is that both functions are equally good to use with geometry since geometry has an autocast for both
-- so you end up with an ambiguous function error. To force PostgreSQL to choose, you do a CAST(mygeom As box3d) or mygeom::box3d.</para>
<para><emphasis>At least as of PostgreSQL 8.3</emphasis> - Everything can be CAST to text (presumably because of the magical unknown type), so no defined CASTS for that need to be present for you to CAST an object to text.</para>
</abstract>
</sect1info>
<title>PostgreSQL PostGIS Types</title>
<refentry id="box2d">
<refnamediv>
<refname>box2d</refname>
<refpurpose>A box composed of x min, ymin, xmax, ymax. Often used to return the 2d enclosing box of a geometry. </refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para>box2d is a spatial data type used to represent the enclosing box of a geometry or set of geometries. ST_Extent in earlier versions prior to PostGIS 1.4 would return a box2d.</para>
</refsection>
</refentry>
<refentry id="box3d">
<refnamediv>
<refname>box3d</refname>
<refpurpose>A box composed of x min, ymin, zmin, xmax, ymax, zmax. Often used to return the 3d extent of a geometry or collection of geometries. </refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para>box3d is a postgis spatial data type used to represent the enclosing box of a geometry or set of geometries. ST_3DExtent returns a box3d object.</para>
</refsection>
<refsection>
<title>Casting Behavior</title>
<para>This section lists the automatic as well as 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>
</refentry>
<refentry id="box3d_extent">
<refnamediv>
<refname>box3d_extent</refname>
<refpurpose>A box composed of x min, ymin, zmin, xmax, ymax, zmax. Often used to return the extent of a geometry.</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para>box3d_extent is a data type returned by ST_Extent. In versions prior to PostGIS 1.4, ST_Extent would return a box2d.</para>
</refsection>
<refsection>
<title>Casting Behavior</title>
<para>This section lists the automatic as well as 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>box2d</entry>
<entry>automatic</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 id="geometry">
<refnamediv>
<refname>geometry</refname>
<refpurpose>Planar spatial data type.</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para>geometry is a fundamental postgis spatial data type used to represent a feature in the Euclidean coordinate system.</para>
</refsection>
<refsection>
<title>Casting Behavior</title>
<para>This section lists the automatic as well as 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" /></para>
</refsection>
</refentry>
<refentry id="geometry_dump">
<refnamediv>
<refname>geometry_dump</refname>
<refpurpose>A spatial datatype with two fields - geom (holding a geometry object)
and path[] (a 1-d array holding the position of the geometry within the dumped object.)</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para>geometry_dump is a compound data type consisting of a geometry object referenced by the .geom field
and path[] a 1-dimensional integer array (starting at 1 e.g. path[1] to get first element) array that defines the navigation path within the dumped geometry to find this element.
It is used by the ST_Dump* family of functions as an output type to explode a more complex geometry into its
constituent parts and location of parts.</para>
</refsection>
<refsection>
<title>See Also</title>
<para><xref linkend="PostGIS_Geometry_DumpFunctions" /> </para>
</refsection>
</refentry>
<refentry id="geomval">
<refnamediv>
<refname>geomval</refname>
<refpurpose>A spatial datatype with two fields - geom (holding a geometry object)
and val (holding a double precision pixel value from a raster band)</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para>geomval is a compound data type consisting of a geometry object referenced by the .geom field
and val, a double precision value that represents the pixel value at a particular geometric location in a raster band.
It is used by the ST_DumpAsPolygon and Raster intersection family of functions as an output type to explode a raster band into
geometry polygons.</para>
</refsection>
<refsection>
<title>See Also</title>
<para><xref linkend="PostGIS_Geometry_DumpFunctions" /> </para>
</refsection>
</refentry>
<refentry id="geography">
<refnamediv>
<refname>geography</refname>
<refpurpose>Ellipsoidal spatial data type.</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para>geography is a spatial data type used to represent a feature in the round-earth coordinate system.</para>
</refsection>
<refsection>
<title>Casting Behavior</title>
<para>This section lists the automatic as well as 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_GeographyFunctions" />,<xref linkend="PostGIS_Geography" /></para>
</refsection>
</refentry>
<refentry id="raster">
<refnamediv>
<refname>raster</refname>
<refpurpose>raster spatial data type.</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para>raster is a spatial data type used to represent raster data such as those imported from jpegs, tiffs, pngs, digital elevation models.
Each raster has 1 or more bands each having a set of pixel values. Rasters can be georeferenced.</para>
<note>
<para>Requires PostGIS be compiled with GDAL support. Currently rasters can be implicitly converted to geometry type, but the conversion returns the
<xref linkend="RT_ST_ConvexHull" /> of the raster. This auto casting may be removed in the near future so don't rely on it.</para>
</note>
</refsection>
<refsection>
<title>Casting Behavior</title>
<para>This section lists the automatic as well as 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>automatic</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsection>
<refsection>
<title>See Also</title>
<para><xref linkend="RT_reference" /></para>
</refsection>
</refentry>
</sect1>