From: Regina Obe Date: Sat, 28 Nov 2009 06:40:05 +0000 (+0000) Subject: fill out casting behavior, also list box type functions and links to it and from it X-Git-Tag: 1.5.0b1~158 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2ccffe9686cd8fd0340abde83b55238d66079f70;p=postgis fill out casting behavior, also list box type functions and links to it and from it git-svn-id: http://svn.osgeo.org/postgis/trunk@4924 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/reference_type.xml b/doc/reference_type.xml index 920d4ceb3..5c19dded8 100644 --- a/doc/reference_type.xml +++ b/doc/reference_type.xml @@ -1,7 +1,18 @@ PostgreSQL PostGIS Types - + 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. + + 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. + + 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. + box2d @@ -23,6 +34,33 @@ Description box3d is a postgis spatial data type used to represent the enclosing box of a geometry or set of geometries. ST_Extent3D returns a box3d object. + + + Casting Behavor + This section lists the automatic as well as explicit casts allowed for this data type + + + + + Cast To + Behavior + + + box + automatic + + + box2d + automatic + + + geometry + automatic + + + + + @@ -35,32 +73,38 @@ Description box3d_extent is a data type returned by ST_Extent. In versions prior to PostGIS 1.4, ST_Extent would return a box2d. + - Casting Behavor + Casting Behavor This section lists the automatic as well as explicit casts allowed for this data type - - - - Cast To - Behavior - - - box2d - automatic - - - box3d - automatic - - - geometry - automatic - - - + + + + Cast To + Behavior + + + box2d + automatic + + + box3d + automatic + + + geometry + automatic + + + - + + + + See Also + + @@ -74,6 +118,45 @@ geometry is a fundamental postgis spatial data type used to represent a feature in the Euclidean coordinate system. + + Casting Behavor + This section lists the automatic as well as explicit casts allowed for this data type + + + + + Cast To + Behavior + + + box + automatic + + + box2d + automatic + + + box3d + automatic + + + bytea + automatic + + + geography + automatic + + + text + automatic + + + + + + See Also @@ -108,7 +191,26 @@ Description - GEOGRAPHY is a spatial data type used to represent a feature in the round-earth coordinate system. + geography is a spatial data type used to represent a feature in the round-earth coordinate system. + + + + Casting Behavor + This section lists the automatic as well as explicit casts allowed for this data type + + + + + Cast To + Behavior + + + geometry + explicit + + + + diff --git a/doc/xsl/postgis_aggs_mm.xml.xsl b/doc/xsl/postgis_aggs_mm.xml.xsl index 8a9e8de02..902d8b54b 100644 --- a/doc/xsl/postgis_aggs_mm.xml.xsl +++ b/doc/xsl/postgis_aggs_mm.xml.xsl @@ -131,6 +131,34 @@ + + + PostGIS Box Functions + The functions given below are PostGIS functions that take as input or return as output the box* family of PostGIS spatial types. + The box family of types consists of box2d, box3d, box3d_extent + + + + + + + + + + + + + + + + + + - + + + + + PostGIS Functions that support 3D