From: Paul Ramsey Date: Thu, 16 Sep 2004 20:36:48 +0000 (+0000) Subject: Reorganize OpenGIS function reference into categories. X-Git-Tag: pgis_1_0_0RC1~442 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=745a0392179b3d39c6ed661488f308d74dcdcc23;p=postgis Reorganize OpenGIS function reference into categories. git-svn-id: http://svn.osgeo.org/postgis/trunk@829 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/postgis.xml b/doc/postgis.xml index 31147f6d2..82387d617 100644 --- a/doc/postgis.xml +++ b/doc/postgis.xml @@ -1490,13 +1490,11 @@ SELECT UPDATE_GEOMETRY_STATS([table_name], [column_name]); - If you find the planner wrong about the cost of - sequencial vs index scans try reducing the value of - random_page_cost in postgresql.conf or using SET - random_page_cost=#. Default value for the parameter - is 4, try setting it to 1 or 2. Decrementing the - value makes the planner more inclined of using Index scans. - + If you find the planner wrong about the cost of sequencial + vs index scans try reducing the value of random_page_cost in + postgresql.conf or using SET random_page_cost=#. Default value for + the parameter is 4, try setting it to 1 or 2. Decrementing the + value makes the planner more inclined of using Index scans. @@ -2285,668 +2283,1030 @@ if( geom.getType() = Geometry.POLYGON ) OpenGIS Functions - - - AddGeometryColumn(varchar, varchar, varchar, integer, varchar, - integer) + + Management Functions - - Syntax: AddGeometryColumn(<schema_name>, - <table_name>, <column_name>, <srid>, - <type>, <dimension>). Adds a geometry column to an - existing table of attributes. The schema_name - is the name of the table schema (unused for pre-schema PostgreSQL - installations). The srid must be an integer - value reference to an entry in the SPATIAL_REF_SYS table. The - type must be an uppercase string corresponding - to the geometry type, eg, 'POLYGON' or 'MULTILINESTRING'. - - + + + AddGeometryColumn(varchar, varchar, varchar, integer, + varchar, integer) - - DropGeometryColumn(varchar, varchar, varchar) + + Syntax: AddGeometryColumn(<schema_name>, + <table_name>, <column_name>, <srid>, + <type>, <dimension>). Adds a geometry column to an + existing table of attributes. The schema_name + is the name of the table schema (unused for pre-schema + PostgreSQL installations). The srid must be + an integer value reference to an entry in the SPATIAL_REF_SYS + table. The type must be an uppercase string + corresponding to the geometry type, eg, 'POLYGON' or + 'MULTILINESTRING'. + + - - Syntax: DropGeometryColumn(<schema_name>, - <table_name>, <column_name>). Remove a geometry column - from a spatial table. Note that schema_name will need to match the - f_schema_name field of the table's row in the geometry_columns - table. - - + + DropGeometryColumn(varchar, varchar, varchar) - - AsBinary(geometry) + + Syntax: DropGeometryColumn(<schema_name>, + <table_name>, <column_name>). Remove a geometry + column from a spatial table. Note that schema_name will need to + match the f_schema_name field of the table's row in the + geometry_columns table. + + - - Returns the geometry in the OGC "well-known-binary" format, - using the endian encoding of the server on which the database is - running. This is useful in binary cursors to pull data out of the - database without converting it to a string representation. + + SetSRID(geometry) - OGC SPEC s2.1.1.1 - also see - asBinary(<geometry>,'XDR') and - asBinary(<geometry>,'NDR') - - + + Set the SRID on a geometry to a particular integer value. + Useful in constructing bounding boxes for queries. + + + + - - Dimension(geometry) + + Geometry Relationship Functions - - 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 points, 1 for lines, 2 for polygons, and - the largest dimension of the components of a - GEOMETRYCOLLECTION. + + + Distance(geometry,geometry) - select dimension('GEOMETRYCOLLECTION(LINESTRING(1 1,0 0),POINT(0 0)'); -dimension ------------ -1 - - + + Return the cartesian distance between two geometries in + projected units. + + - - isEmpty(geometry) + + Equals(geometry,geometry) - - Returns 1 (TRUE) if this Geometry is the empty geometry . If - true, then this Geometry represents the empty point set - i.e. - GEOMETRYCOLLECTION(EMPTY). + + Returns 1 (TRUE) if this Geometry is "spatially equal" to + anotherGeometry. Use this for a 'better' answer than '='. equals + ('LINESTRING(0 0, 10 10)','LINESTRING(0 0, 5 5, 10 10)') is + true. - OGC SPEC s2.1.1.1 - - + Performed by the GEOS module - - isSimple(geometry) + OGC SPEC s2.1.1.2 + + - - Returns 1 (TRUE) if this Geometry has no anomalous geometric - points, such as self intersection or self tangency. + + Disjoint(geometry,geometry) - Performed by the GEOS module + + Returns 1 (TRUE) if this Geometry is "spatially disjoint" + from anotherGeometry. - OGC SPEC s2.1.1.1 - - + Performed by the GEOS module - - boundary(geometry) + Do not call with a GeometryCollection as an + argument - - 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. + NOTE: this is the "allowable" version that returns a + boolean, not an integer. - Performed by the GEOS module + OGC SPEC s2.1.1.2 //s2.1.13.3 - a.Relate(b, + 'FF*FF****') + + - OGC SPEC s2.1.1.1 - - + + Intersects(geometry,geometry) - - equals(geometry) + + Returns 1 (TRUE) if this Geometry "spatially intersects" + anotherGeometry. - - Returns 1 (TRUE) if this Geometry is "spatially equal" to - anotherGeometry. Use this for a 'better' answer than '='. equals - ('LINESTRING(0 0, 10 10)','LINESTRING(0 0, 5 5, 10 10)') is - true. + Performed by the GEOS module - Performed by the GEOS module + Do not call with a GeometryCollection as an + argument - OGC SPEC s2.1.1.2 - - + NOTE: this is the "allowable" version that returns a + boolean, not an integer. - - disjoint(geometry,geometry) + OGC SPEC s2.1.1.2 //s2.1.13.3 - Intersects(g1, g2 ) --> + Not (Disjoint(g1, g2 )) + + - - Returns 1 (TRUE) if this Geometry is "spatially disjoint" - from anotherGeometry. + + Touches(geometry,geometry) - Performed by the GEOS module + + Returns 1 (TRUE) if this Geometry "spatially touches" + anotherGeometry. - Do not call with a GeometryCollection as an argument + Performed by the GEOS module - NOTE: this is the "allowable" version that returns a - boolean, not an integer. + Do not call with a GeometryCollection as an + argument - OGC SPEC s2.1.1.2 //s2.1.13.3 - a.Relate(b, - 'FF*FF****') - - + NOTE: this is the "allowable" version that returns a + boolean, not an integer. - - intersects(geometry,geometry) + OGC SPEC s2.1.1.2 // s2.1.13.3- a.Touches(b) -> (I(a) + intersection I(b) = {empty set} ) and (a intersection b) not + empty + + - - Returns 1 (TRUE) if this Geometry "spatially intersects" - anotherGeometry. + + Crosses(geometry,geometry) - Performed by the GEOS module + + Returns 1 (TRUE) if this Geometry "spatially crosses" + anotherGeometry. - Do not call with a GeometryCollection as an argument + Performed by the GEOS module - NOTE: this is the "allowable" version that returns a - boolean, not an integer. + Do not call with a GeometryCollection as an + argument - OGC SPEC s2.1.1.2 //s2.1.13.3 - Intersects(g1, g2 ) --> - Not (Disjoint(g1, g2 )) - - + NOTE: this is the "allowable" version that returns a + boolean, not an integer. - - touches(geometry,geometry) + OGC SPEC s2.1.1.2 // s2.1.13.3 - a.Relate(b, + 'T*T******') + + - - Returns 1 (TRUE) if this Geometry "spatially touches" - anotherGeometry. + + Within(geometry,geometry) - Performed by the GEOS module + + Returns 1 (TRUE) if this Geometry is "spatially within" + anotherGeometry. - Do not call with a GeometryCollection as an argument + Performed by the GEOS module - NOTE: this is the "allowable" version that returns a - boolean, not an integer. + Do not call with a GeometryCollection as an + argument - OGC SPEC s2.1.1.2 // s2.1.13.3- a.Touches(b) -> (I(a) - intersection I(b) = {empty set} ) and (a intersection b) not - empty - - + NOTE: this is the "allowable" version that returns a + boolean, not an integer. - - crosses(geometry,geometry) + OGC SPEC s2.1.1.2 // s2.1.13.3 - a.Relate(b, + 'T*F**F***') + + - - Returns 1 (TRUE) if this Geometry "spatially crosses" - anotherGeometry. + + Overlaps(geometry,geometry) - Performed by the GEOS module + + Returns 1 (TRUE) if this Geometry is "spatially + overlapping" anotherGeometry. - Do not call with a GeometryCollection as an argument + Performed by the GEOS module - NOTE: this is the "allowable" version that returns a - boolean, not an integer. + Do not call with a GeometryCollection as an + argument - OGC SPEC s2.1.1.2 // s2.1.13.3 - a.Relate(b, - 'T*T******') - - + NOTE: this is the "allowable" version that returns a + boolean, not an integer. - - within(geometry,geometry) + OGC SPEC s2.1.1.2 // s2.1.13.3 + + - - Returns 1 (TRUE) if this Geometry is "spatially within" - anotherGeometry. + + Contains(geometry,geometry) - Performed by the GEOS module + + Returns 1 (TRUE) if this Geometry is "spatially contains" + anotherGeometry. - Do not call with a GeometryCollection as an argument + Performed by the GEOS module - NOTE: this is the "allowable" version that returns a - boolean, not an integer. + Do not call with a GeometryCollection as an + argument - OGC SPEC s2.1.1.2 // s2.1.13.3 - a.Relate(b, - 'T*F**F***') - - + NOTE: this is the "allowable" version that returns a + boolean, not an integer. - - overlaps(geometry,geometry) + OGC SPEC s2.1.1.2 // s2.1.13.3 - same as + within(geometry,geometry) + + - - Returns 1 (TRUE) if this Geometry is "spatially overlapping" - anotherGeometry. + + Intersects(geometry,geometry) - Performed by the GEOS module + + Returns 1 (TRUE) if this Geometry is "spatially + intersects" anotherGeometry. - Do not call with a GeometryCollection as an argument + Performed by the GEOS module - NOTE: this is the "allowable" version that returns a - boolean, not an integer. + Do not call with a GeometryCollection as an + argument - OGC SPEC s2.1.1.2 // s2.1.13.3 - - + NOTE: this is the "allowable" version that returns a + boolean, not an integer. - - contains(geometry,geometry) + OGC SPEC s2.1.1.2 // s2.1.13.3 - NOT + disjoint(geometry,geometry) + + - - Returns 1 (TRUE) if this Geometry is "spatially contains" - anotherGeometry. + + Relate(geometry,geometry, intersectionPatternMatrix) - Performed by the GEOS module + + Returns 1 (TRUE) if this Geometry is spatially related to + anotherGeometry, by testing for intersections between the + Interior, Boundary and Exterior of the two geometries as + specified by the values in the intersectionPatternMatrix. - Do not call with a GeometryCollection as an argument + Performed by the GEOS module - NOTE: this is the "allowable" version that returns a - boolean, not an integer. + Do not call with a GeometryCollection as an + argument - OGC SPEC s2.1.1.2 // s2.1.13.3 - same as - within(geometry,geometry) - - + NOTE: this is the "allowable" version that returns a + boolean, not an integer. - - intersects(geometry,geometry) + OGC SPEC s2.1.1.2 // s2.1.13.3 + + - - Returns 1 (TRUE) if this Geometry is "spatially intersects" - anotherGeometry. + + Relate(geometry,geometry) - Performed by the GEOS module + + returns the DE-9IM (dimensionally extended + nine-intersection matrix) - Do not call with a GeometryCollection as an argument + Performed by the GEOS module - NOTE: this is the "allowable" version that returns a - boolean, not an integer. + Do not call with a GeometryCollection as an + argument - OGC SPEC s2.1.1.2 // s2.1.13.3 - NOT - disjoint(geometry,geometry) - - + not in OGC spec, but implied. see s2.1.13.2 + + + + - - relate(geometry,geometry, intersectionPatternMatrix) + + Geometry Processing Functions - - Returns 1 (TRUE) if this Geometry is spatially related to - anotherGeometry, by testing for intersections between the - Interior, Boundary and Exterior of the two geometries as specified - by the values in the intersectionPatternMatrix. + + + Centroid(geometry) - Performed by the GEOS module + + Returns the centroid of the geometry as a point. - Do not call with a GeometryCollection as an argument + Computation will be more accurate if performed by the GEOS + module (enabled at compile time). + + - NOTE: this is the "allowable" version that returns a - boolean, not an integer. + + Area(geometry) - OGC SPEC s2.1.1.2 // s2.1.13.3 - - + + Returns the area of the geometry if it is a polygon or + multi-polygon. + + - - relate(geometry,geometry) + + Length(geometry) - - returns the DE-9IM (dimensionally extended nine-intersection - matrix) + + The length of this Curve in its associated spatial + reference. - Performed by the GEOS module + synonym for length2d() - Do not call with a GeometryCollection as an argument + OGC SPEC 2.1.5.1 + + - not in OGC spec, but implied. see s2.1.13.2 - - + + PointOnSurface(geometry) - - buffer(geometry,double) + + Return a Point guaranteed to lie on the surface - - Returns a geometry that represents all points whose distance - from this Geometry is less than or equal to distance. Calculations - are in the Spatial Reference System of this Geometry. + Implemented using GEOS - Performed by the GEOS module + OGC SPEC 3.2.14.2 and 3.2.18.2 - + + - Do not call with a GeometryCollection as an argument + + Boundary(geometry) - OGC SPEC s2.1.1.3 - - + + 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. - - convexhull(geometry) + Performed by the GEOS module - - Returns a geometry that represents the convex hull of this - Geometry. + OGC SPEC s2.1.1.1 + + - Performed by the GEOS module + + Buffer(geometry,double) - OGC SPEC s2.1.1.3 - - + + Returns a geometry that represents all points whose + distance from this Geometry is less than or equal to distance. + Calculations are in the Spatial Reference System of this + Geometry. - - intersection(geometry,geometry) + Performed by the GEOS module - - Returns a geometry that represents the point set - intersection of this Geometry with anotherGeometry. + Do not call with a GeometryCollection as an + argument - Performed by the GEOS module + OGC SPEC s2.1.1.3 + + - Do not call with a GeometryCollection as an argument + + ConvexHull(geometry) - OGC SPEC s2.1.1.3 - - + + Returns a geometry that represents the convex hull of this + Geometry. - + Performed by the GEOS module - - GeomUnion(geometry,geometry) + OGC SPEC s2.1.1.3 + + - - Returns a geometry that represents the point set union of - this Geometry with anotherGeometry. + + Intersection(geometry,geometry) - Performed by the GEOS module + + Returns a geometry that represents the point set + intersection of this Geometry with anotherGeometry. - Do not call with a GeometryCollection as an argument + Performed by the GEOS module - NOTE: this is renamed from "union" because union is an SQL - reserved word + Do not call with a GeometryCollection as an + argument - OGC SPEC s2.1.1.3 - - + OGC SPEC s2.1.1.3 + + - - GeomUnion(geometry set) + + SymDifference(geometry,geometry) - - Returns a geometry that represents the point set union of - this all Geometries in given set. + + Returns a geometry that represents the point set symmetric + difference of this Geometry with anotherGeometry. - Performed by the GEOS module + Performed by the GEOS module - Do not call with a GeometryCollection in the argument - set + Do not call with a GeometryCollection as an + argument - Not explicitly defined in OGC SPEC - - + OGC SPEC s2.1.1.3 + + - - memGeomUnion(geometry set) + + Difference(geometry,geometry) - - Same as the above, only memory-friendly (uses less memory - and more processor time). - - + + Returns a geometry that represents the point set symmetric + difference of this Geometry with anotherGeometry. - - symdifference(geometry,geometry) + Performed by the GEOS module - - Returns a geometry that represents the point set symmetric - difference of this Geometry with anotherGeometry. + Do not call with a GeometryCollection as an + argument - Performed by the GEOS module + OGC SPEC s2.1.1.3 + + - Do not call with a GeometryCollection as an argument + + GeomUnion(geometry,geometry) - OGC SPEC s2.1.1.3 - - + + Returns a geometry that represents the point set union of + this Geometry with anotherGeometry. - - difference(geometry,geometry) + Performed by the GEOS module - - Returns a geometry that represents the point set symmetric - difference of this Geometry with anotherGeometry. + Do not call with a GeometryCollection as an + argument - Performed by the GEOS module + NOTE: this is renamed from "union" because union is an SQL + reserved word - Do not call with a GeometryCollection as an argument + OGC SPEC s2.1.1.3 + + - OGC SPEC s2.1.1.3 - - + + GeomUnion(geometry set) - - Envelope(geometry) + + Returns a geometry that represents the point set union of + this all Geometries in given set. - - Returns a POLYGON representing the bounding box of the - geometry. + Performed by the GEOS module - OGC SPEC s2.1.1.1 - The minimum bounding box for this - Geometry, returned as a Geometry. The polygon is defined by the - corner points of the bounding box ((MINX, MINY), (MAXX, MINY), - (MAXX, MAXY), (MINX, MAXY), (MINX, MINY)). + Do not call with a GeometryCollection in the argument + set - NOTE:PostGIS will add a Zmin/Zmax coordinate as well. - - + Not explicitly defined in OGC SPEC + + - - GeometryType(geometry) + + MemGeomUnion(geometry set) - - Returns the type of the geometry as a string. Eg: - 'LINESTRING', 'POLYGON', 'MULTIPOINT', etc. + + Same as the above, only memory-friendly (uses less memory + and more processor time). + + + + - 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. - - + + Geometry Accessors - - X(geometry) + + + AsText(geometry) - - Find and return the X coordinate of the first point in the - geometry. Return NULL if there is no point in the geometry. - - + + Return the Well-Known Text representation of the geometry. + For example: POLYGON(0 0,0 1,1 1,1 0,0 0) - - Y(geometry) + OGC SPEC s2.1.1.1 + + - - Find and return the Y coordinate of the first point in the - geometry. Return NULL if there is no point in the geometry. - - + + AsBinary(geometry) - - Z(geometry) + + Returns the geometry in the OGC "well-known-binary" + format, using the endian encoding of the server on which the + database is running. This is useful in binary cursors to pull + data out of the database without converting it to a string + representation. + + OGC SPEC s2.1.1.1 - also see + asBinary(<geometry>,'XDR') and + asBinary(<geometry>,'NDR') + + - - Find and return the Z coordinate of the first point in the - geometry. Return NULL if there is no point in the geometry. - - + + SRID(geometry) - - NumPoints(geometry) + + Returns the integer SRID number of the spatial reference + system of the geometry. - - Find and return the number of points in the first linestring - in the geometry. Return NULL if there is no linestring in the - geometry. - - + OGC SPEC s2.1.1.1 + + - - PointN(geometry,integer) + + Dimension(geometry) - - Return the N'th point in the first linestring in the - geometry. Return NULL if there is no linestring in the - geometry. - - + + 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 points, 1 for lines, 2 for polygons, + and the largest dimension of the components of a + GEOMETRYCOLLECTION. - - ExteriorRing(geometry) + select dimension('GEOMETRYCOLLECTION(LINESTRING(1 1,0 0),POINT(0 0)'); +dimension +----------- +1 + + - - Return the exterior ring of the first polygon in the - geometry. Return NULL if there is no polygon in the - geometry. - - + + Envelope(geometry) - - NumInteriorRings(geometry) + + Returns a POLYGON representing the bounding box of the + geometry. - - Return the number of interior rings of the first polygon in - the geometry. Return NULL if there is no polygon in the - geometry. - - + OGC SPEC s2.1.1.1 - The minimum bounding box for this + Geometry, returned as a Geometry. The polygon is defined by the + corner points of the bounding box ((MINX, MINY), (MAXX, MINY), + (MAXX, MAXY), (MINX, MAXY), (MINX, MINY)). - - InteriorRingN(geometry,integer) + NOTE:PostGIS will add a Zmin/Zmax coordinate as + well. + + - - Return the N'th interior ring of the first polygon in the - geometry. Return NULL if there is no polygon in the - geometry. - - + + IsEmpty(geometry) - - IsClosed(geometry) + + Returns 1 (TRUE) if this Geometry is the empty geometry . + If true, then this Geometry represents the empty point set - + i.e. GEOMETRYCOLLECTION(EMPTY). - - Returns true of the geometry start and end points are - coincident. - - + OGC SPEC s2.1.1.1 + + - - IsRing(geometry) + + IsSimple(geometry) - - Returns 1 (TRUE) if this Curve is closed (StartPoint ( ) = - EndPoint ( )) and this Curve is simple (does not pass through the - same point more than once). + + Returns 1 (TRUE) if this Geometry has no anomalous + geometric points, such as self intersection or self + tangency. - performed by GEOS + Performed by the GEOS module - OGC spec 2.1.5.1 - - + OGC SPEC s2.1.1.1 + + - - NumGeometries(geometry) + + IsClosed(geometry) - - If geometry is a GEOMETRYCOLLECTION (or MULTI*) return the - number of geometries, otherwise return NULL. - - + + Returns true of the geometry start and end points are + coincident. + + - - GeometryN(geometry,int) + + IsRing(geometry) - - Return the N'th geometry if the geometry is a - GEOMETRYCOLLECTION, MULTIPOINT, MULTILINESTRING or MULTIPOLYGON. - Otherwise, return NULL. + + Returns 1 (TRUE) if this Curve is closed (StartPoint ( ) = + EndPoint ( )) and this Curve is simple (does not pass through + the same point more than once). - 1 is 1st geometry - - + performed by GEOS - - Distance(geometry,geometry) + OGC spec 2.1.5.1 + + - - Return the cartesian distance between two geometries in - projected units. - - + + NumGeometries(geometry) - - AsText(geometry) + + If geometry is a GEOMETRYCOLLECTION (or MULTI*) return the + number of geometries, otherwise return NULL. + + - - Return the Well-Known Text representation of the geometry. - For example: POLYGON(0 0,0 1,1 1,1 0,0 0) + + GeometryN(geometry,int) - OGC SPEC s2.1.1.1 - - + + Return the N'th geometry if the geometry is a + GEOMETRYCOLLECTION, MULTIPOINT, MULTILINESTRING or MULTIPOLYGON. + Otherwise, return NULL. - - SRID(geometry) + 1 is 1st geometry + + - - Returns the integer SRID number of the spatial reference - system of the geometry. + + NumPoints(geometry) - OGC SPEC s2.1.1.1 - - + + Find and return the number of points in the first + linestring in the geometry. Return NULL if there is no + linestring in the geometry. + + - - GeometryFromText(varchar, integer) + + PointN(geometry,integer) - - Syntax: GeometryFromText(<geometry>,<SRID>) - Convert a Well-Known Text representation of a geometry into a - geometry object. - - + + Return the N'th point in the first linestring in the + geometry. Return NULL if there is no linestring in the + geometry. + + + + + ExteriorRing(geometry) + + + Return the exterior ring of the first polygon in the + geometry. Return NULL if there is no polygon in the + geometry. + + + + + NumInteriorRings(geometry) + + + Return the number of interior rings of the first polygon + in the geometry. Return NULL if there is no polygon in the + geometry. + + + + + InteriorRingN(geometry,integer) + + + Return the N'th interior ring of the first polygon in the + geometry. Return NULL if there is no polygon in the + geometry. + + + + + EndPoint(geometry) + + + Returns the last point of the geometry as a point. + + + + + StartPoint(geometry) + + + Returns the first point of the geometry as a point. + + + + + GeometryType(geometry) + + + Returns the type of the geometry as a string. Eg: + 'LINESTRING', 'POLYGON', 'MULTIPOINT', etc. + + 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. + + + + + X(geometry) + + + Find and return the X coordinate of the first point in the + geometry. Return NULL if there is no point in the + geometry. + + + + + Y(geometry) + + + Find and return the Y coordinate of the first point in the + geometry. Return NULL if there is no point in the + geometry. + + + + + Z(geometry) + + + Find and return the Z coordinate of the first point in the + geometry. Return NULL if there is no point in the + geometry. + + + + + + + Geometry Constructors + + + + GeomFromText(text,[<srid>]) + + + Makes a Geometry from WKT with the given SRID. If SRID is + not give, it defaults to -1. + + OGC SPEC 3.2.6.2 - option SRID is from the conformance + suite + + + + + GeometryFromText(text,[<srid>]) + + + Makes a Geometry from WKT with the given SRID. If SRID is + not give, it defaults to -1. + + OGC SPEC 3.2.6.2 - option SRID is from the conformance + suite + + + + + PointFromText(text,[<srid>]) + + + Makes a Geometry from WKT with the given SRID. If SRID is + not give, it defaults to -1. + + OGC SPEC 3.2.6.2 - option SRID is from the conformance + suite + + Throws an error if the WKT is not a Point + + + + + LineFromText(text,[<srid>]) + + + Makes a Geometry from WKT with the given SRID. If SRID is + not give, it defaults to -1. + + OGC SPEC 3.2.6.2 - option SRID is from the conformance + suite + + Throws an error if the WKT is not a Line + + + + + LinestringFromText(text,[<srid>]) + + + Makes a Geometry from WKT with the given SRID. If SRID is + not give, it defaults to -1. + + from the conformance suite + + Throws an error if the WKT is not a Line + + + + + PolyFromText(text,[<srid>]) + + + Makes a Geometry from WKT with the given SRID. If SRID is + not give, it defaults to -1. + + OGC SPEC 3.2.6.2 - option SRID is from the conformance + suite + + Throws an error if the WKT is not a Polygon + + + + + PolygonFromText(text,[<srid>]) + + + Makes a Geometry from WKT with the given SRID. If SRID is + not give, it defaults to -1. + + from the conformance suite + + Throws an error if the WKT is not a Polygon + + + + + MPointFromText(text,[<srid>]) + + + Makes a Geometry from WKT with the given SRID. If SRID is + not give, it defaults to -1. + + OGC SPEC 3.2.6.2 - option SRID is from the conformance + suite + + Throws an error if the WKT is not a MULTIPOINT + + + + + MLineFromText(text,[<srid>]) + + + Makes a Geometry from WKT with the given SRID. If SRID is + not give, it defaults to -1. + + OGC SPEC 3.2.6.2 - option SRID is from the conformance + suite + + Throws an error if the WKT is not a MULTILINESTRING + + + + + MPolyFromText(text,[<srid>]) + + + Makes a Geometry from WKT with the given SRID. If SRID is + not give, it defaults to -1. + + OGC SPEC 3.2.6.2 - option SRID is from the conformance + suite + + Throws an error if the WKT is not a MULTIPOLYGON + + + + + GeomCollFromText(text,[<srid>]) + + + Makes a Geometry from WKT with the given SRID. If SRID is + not give, it defaults to -1. + + OGC SPEC 3.2.6.2 - option SRID is from the conformance + suite + + Throws an error if the WKT is not a + GEOMETRYCOLLECTION + + + + + GeomFromWKB(text,[<srid>]) + + + Makes a Geometry from WKB with the given SRID. If SRID is + not give, it defaults to -1. + + OGC SPEC 3.2.6.2 - option SRID is from the conformance + suite + + + + + GeomFromWKB(text,[<srid>]) + + + Makes a Geometry from WKB with the given SRID. If SRID is + not give, it defaults to -1. + + OGC SPEC 3.2.7.2 - option SRID is from the conformance + suite + + + + + PointFromWKB(text,[<srid>]) + + + Makes a Geometry from WKB with the given SRID. If SRID is + not give, it defaults to -1. + + OGC SPEC 3.2.7.2 - option SRID is from the conformance + suite + + throws an error if WKB is not a POINT + + + + + LineFromWKB(text,[<srid>]) + + + Makes a Geometry from WKB with the given SRID. If SRID is + not give, it defaults to -1. + + OGC SPEC 3.2.7.2 - option SRID is from the conformance + suite + + throws an error if WKB is not a LINESTRING + + + + + LinestringFromWKB(text,[<srid>]) + + + Makes a Geometry from WKB with the given SRID. If SRID is + not give, it defaults to -1. + + from the conformance suite + + throws an error if WKB is not a LINESTRING + + + + + PolyFromWKB(text,[<srid>]) + + + Makes a Geometry from WKB with the given SRID. If SRID is + not give, it defaults to -1. + + OGC SPEC 3.2.7.2 - option SRID is from the conformance + suite + + throws an error if WKB is not a POLYGON + + + + + PolygonFromWKB(text,[<srid>]) + + + Makes a Geometry from WKB with the given SRID. If SRID is + not give, it defaults to -1. + + from the conformance suite + + throws an error if WKB is not a POLYGON + + + + + MPointFromWKB(text,[<srid>]) + + + Makes a Geometry from WKB with the given SRID. If SRID is + not give, it defaults to -1. + + OGC SPEC 3.2.7.2 - option SRID is from the conformance + suite + + throws an error if WKB is not a MULTIPOINT + + - - GeomFromText(varchar, integer) + + MLineFromWKB(text,[<srid>]) - - As above. A synonym for GeometryFromText. - - + + Makes a Geometry from WKB with the given SRID. If SRID is + not give, it defaults to -1. - - SetSRID(geometry) + OGC SPEC 3.2.7.2 - option SRID is from the conformance + suite - - Set the SRID on a geometry to a particular integer value. - Useful in constructing bounding boxes for queries. - - + throws an error if WKB is not a MULTILINESTRING + + - - EndPoint(geometry) + + MPolyFromWKB(text,[<srid>]) - - Returns the last point of the geometry as a point. - - + + Makes a Geometry from WKB with the given SRID. If SRID is + not give, it defaults to -1. - - StartPoint(geometry) + OGC SPEC 3.2.7.2 - option SRID is from the conformance + suite - - Returns the first point of the geometry as a point. - - + throws an error if WKB is not a MULTIPOLYGON + + - - Centroid(geometry) + + GeomCollFromWKB(text,[<srid>]) - - Returns the centroid of the geometry as a point. + + Makes a Geometry from WKB with the given SRID. If SRID is + not give, it defaults to -1. - Computation will be more accurate if performed by the GEOS - module (enabled at compile time). - - - + OGC SPEC 3.2.7.2 - option SRID is from the conformance + suite + + throws an error if WKB is not a GEOMETRYCOLLECTION + + + + @@ -3060,15 +3420,6 @@ dimension - - area(geometry) - - - Returns the area of the geometry if it is a polygon or - multi-polygon. (same as area2(<polygon|multipolygon>) - - - asbinary(geometry,'NDR') @@ -3099,315 +3450,6 @@ dimension - - GeomFromText(text,[<srid>]) - - - Makes a Geometry from WKT with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.6.2 - option SRID is from the conformance - suite - - - - - GeometryFromText(text,[<srid>]) - - - Makes a Geometry from WKT with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.6.2 - option SRID is from the conformance - suite - - - - - PointFromText(text,[<srid>]) - - - Makes a Geometry from WKT with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.6.2 - option SRID is from the conformance - suite - - Throws an error if the WKT is not a Point - - - - - LineFromText(text,[<srid>]) - - - Makes a Geometry from WKT with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.6.2 - option SRID is from the conformance - suite - - Throws an error if the WKT is not a Line - - - - - LinestringFromText(text,[<srid>]) - - - Makes a Geometry from WKT with the given SRID. If SRID is - not give, it defaults to -1. - - from the conformance suite - - Throws an error if the WKT is not a Line - - - - - PolyFromText(text,[<srid>]) - - - Makes a Geometry from WKT with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.6.2 - option SRID is from the conformance - suite - - Throws an error if the WKT is not a Polygon - - - - - PolygonFromText(text,[<srid>]) - - - Makes a Geometry from WKT with the given SRID. If SRID is - not give, it defaults to -1. - - from the conformance suite - - Throws an error if the WKT is not a Polygon - - - - - MPointFromText(text,[<srid>]) - - - Makes a Geometry from WKT with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.6.2 - option SRID is from the conformance - suite - - Throws an error if the WKT is not a MULTIPOINT - - - - - MLineFromText(text,[<srid>]) - - - Makes a Geometry from WKT with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.6.2 - option SRID is from the conformance - suite - - Throws an error if the WKT is not a MULTILINESTRING - - - - - MPolyFromText(text,[<srid>]) - - - Makes a Geometry from WKT with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.6.2 - option SRID is from the conformance - suite - - Throws an error if the WKT is not a MULTIPOLYGON - - - - - GeomCollFromText(text,[<srid>]) - - - Makes a Geometry from WKT with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.6.2 - option SRID is from the conformance - suite - - Throws an error if the WKT is not a - GEOMETRYCOLLECTION - - - - - GeomFromWKB(text,[<srid>]) - - - Makes a Geometry from WKB with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.6.2 - option SRID is from the conformance - suite - - - - - GeomFromWKB(text,[<srid>]) - - - Makes a Geometry from WKB with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.7.2 - option SRID is from the conformance - suite - - - - - PointFromWKB(text,[<srid>]) - - - Makes a Geometry from WKB with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.7.2 - option SRID is from the conformance - suite - - throws an error if WKB is not a POINT - - - - - LineFromWKB(text,[<srid>]) - - - Makes a Geometry from WKB with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.7.2 - option SRID is from the conformance - suite - - throws an error if WKB is not a LINESTRING - - - - - LinestringFromWKB(text,[<srid>]) - - - Makes a Geometry from WKB with the given SRID. If SRID is - not give, it defaults to -1. - - from the conformance suite - - throws an error if WKB is not a LINESTRING - - - - - PolyFromWKB(text,[<srid>]) - - - Makes a Geometry from WKB with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.7.2 - option SRID is from the conformance - suite - - throws an error if WKB is not a POLYGON - - - - - PolygonFromWKB(text,[<srid>]) - - - Makes a Geometry from WKB with the given SRID. If SRID is - not give, it defaults to -1. - - from the conformance suite - - throws an error if WKB is not a POLYGON - - - - - MPointFromWKB(text,[<srid>]) - - - Makes a Geometry from WKB with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.7.2 - option SRID is from the conformance - suite - - throws an error if WKB is not a MULTIPOINT - - - - - MLineFromWKB(text,[<srid>]) - - - Makes a Geometry from WKB with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.7.2 - option SRID is from the conformance - suite - - throws an error if WKB is not a MULTILINESTRING - - - - - MPolyFromWKB(text,[<srid>]) - - - Makes a Geometry from WKB with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.7.2 - option SRID is from the conformance - suite - - throws an error if WKB is not a MULTIPOLYGON - - - - - GeomCollFromWKB(text,[<srid>]) - - - Makes a Geometry from WKB with the given SRID. If SRID is - not give, it defaults to -1. - - OGC SPEC 3.2.7.2 - option SRID is from the conformance - suite - - throws an error if WKB is not a GEOMETRYCOLLECTION - - - - - PointOnSurface(geometry) - - - Return a Point guaranteed to lie on the surface - - Implemented using GEOS - - OGC SPEC 3.2.14.2 and 3.2.18.2 - - - - box3d(geometry) @@ -3452,6 +3494,17 @@ dimension + distance_sphere(point, point) + + + Returns linear distance in meters between two lat/lon + points. Uses a spherical earth and radius of 6370986 meters. + Faster than distance_spheroid(), but + less accurate. + + + + distance_spheroid(point, point, spheroid) @@ -3528,19 +3581,6 @@ dimension - - length(geometry) - - - The length of this Curve in its associated spatial - reference. - - synonym for length2d() - - OGC SPEC 2.1.5.1 - - - length3d(geometry) @@ -3617,19 +3657,19 @@ FROM geometry_table; - npoints(geometry) + nrings(geometry) - Returns the number of points in the geometry. + If the geometry is a polygon or multi-polygon returns the + number of rings. - nrings(geometry) + npoints(geometry) - If the geometry is a polygon or multi-polygon returns the - number of rings. + Returns the number of points in the geometry. @@ -3642,6 +3682,15 @@ FROM geometry_table; + + perimeter(geometry) + + + Returns the 2-dimensional perimeter of the geometry, if it + is a polygon or multi-polygon. + + + perimeter2d(geometry) @@ -3758,7 +3807,7 @@ FROM geometry_table; Returns a new geometry with its coordinates transformed to the SRID referenced by the integer parameter. The destination SRID - must exist in the SPATIAL_REF_SYS table. + must exist in the SPATIAL_REF_SYS table. @@ -3802,7 +3851,7 @@ FROM geometry_table; - line_interpolate_point(geometry, distance) + line_interpolate_point(geometry, proportion) Interpolates a point along a line. First argument must be a @@ -3826,19 +3875,14 @@ FROM geometry_table; AsSVG(geometry, [rel], [precision]) - Return the geometry as an SVG path data. - Use 1 as second argument to have the path data - implemented in terms of relative moves, the - default (or 0) uses absolute moves. - Third argument may be used to reduce the maximum - number of significant digits used in output - (defaults to 15). - Point geometries will be rendered as cx/cy when - 'rel' arg is 0, x/y when 'rel' is 1. - + Return the geometry as an SVG path data. Use 1 as second + argument to have the path data implemented in terms of relative + moves, the default (or 0) uses absolute moves. Third argument may + be used to reduce the maximum number of significant digits used in + output (defaults to 15). Point geometries will be rendered as + cx/cy when 'rel' arg is 0, x/y when 'rel' is 1. -