From: Regina Obe Date: Thu, 17 Jul 2008 11:20:11 +0000 (+0000) Subject: move over ST_Within and provide example X-Git-Tag: 1.4.0b1~833 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=023d55123f615e8b8115b88f6dacc190d331ad8f;p=postgis move over ST_Within and provide example git-svn-id: http://svn.osgeo.org/postgis/trunk@2866 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/reference.xml b/doc/reference.xml index 7b17c44a9..d848cf8b4 100644 --- a/doc/reference.xml +++ b/doc/reference.xml @@ -64,30 +64,6 @@ - - ST_Within(A geometry, B geometry) - - - Returns TRUE if Geometry A is "spatially within" - Geometry B. A has to be completely inside B. - - Performed by the GEOS module - - Do not call with a GeometryCollection as an argument - - This function call will automatically include a bounding box - comparison that will make use of any indexes that are available on - the geometries. To avoid index use, use the function - _ST_Within. - - NOTE: this is the "allowable" version that returns a - boolean, not an integer. - - OGC SPEC s2.1.1.2 // s2.1.13.3 - a.Relate(b, - 'T*F**F***') - - - ST_Overlaps(A geometry, B geometry) @@ -3265,16 +3241,7 @@ WHERE n*100.00/length < 1; - - ST_Within - - - Test if an ST_Geometry value is spatially within another - ST_Geometry value. - - SQL-MM 3: 5.1.30 - - + ST_WKBToSQL diff --git a/doc/reference_new.xml b/doc/reference_new.xml index 70b9eacf3..47fb4c41b 100644 --- a/doc/reference_new.xml +++ b/doc/reference_new.xml @@ -982,9 +982,11 @@ SELECT DISTINCT ON (s.gid) s.gid, s.school_name, s.the_geom, h.hospital_name Returns TRUE if the given Geometries are "spatially equal". Use this for a 'better' answer than '='. - Note by spatially equal we also mean ordering of points can be different but + Note by spatially equal we mean ST_Within(A,B) = true and ST_Within(B,A) = true and + also mean ordering of points can be different but represent the same geometry structure. To verify the order of points is consistent, use - ST_OrderingEquals. + ST_OrderingEquals (it must be noted ST_OrderingEquals is a little more stringent than simply verifying order of + points are the same). @@ -1017,7 +1019,7 @@ SELECT ST_Equals(ST_Reverse(ST_GeomFromText('LINESTRING(0 0, 10 10)')), See Also - , + , , @@ -1167,6 +1169,100 @@ SELECT ST_OrderingEquals(ST_Reverse(ST_GeomFromText('LINESTRING(0 0, 10 10)')), + + + + ST_Within + + Returns true if the geometry A is completely inside geometry B + + + + + + boolean ST_Within + + geometry + A + + geometry + B + + + + + + Description + + Returns TRUE if geometry A is completely inside geometry B. For this function to make + sense, the source geometries must both be of the same coorindate projection, + having the same SRID. It is a given that if ST_Within(A,B) is true and ST_Within(B,A) is true, then + the two geometries are considered spatially equal. + + Performed by the GEOS module + + Do not call with a GeometryCollection as an argument + + This function call will automatically include a bounding box + comparison that will make use of any indexes that are available on + the geometries. To avoid index use, use the function + _ST_Within. + + NOTE: this is the "allowable" version that returns a + boolean, not an integer. + + + This function call will automatically include a bounding box + comparison that will make use of any indexes that are available on + the geometries. + + + + + + + + This method implements the + OpenGIS Simple Features + Implementation Specification for SQL. + OGC SPEC s2.1.1.2 // s2.1.13.3 - a.Relate(b, + 'T*F**F***') + + + + + + + + This method implements the SQL/MM specification: + SQL-MM 3: 5.1.30 + + + + Examples + +--a circle within a circle +SELECT ST_Within(smallc,smallc) As smallinsmall, + ST_Within(smallc, bigc) As smallinbig, + ST_Within(bigc,smallc) As biginsmall, + ST_Within(ST_Union(smallc, bigc), bigc) as unioninbig, + ST_Within(bigc, ST_Union(smallc, bigc)) as biginunion, + ST_Equals(bigc, ST_Union(smallc, bigc)) as bigisunion +FROM (SELECT ST_Buffer(ST_GeomFromText('POINT(1 2)'), 10) As smallc, + ST_Buffer(ST_GeomFromText('POINT(1 2)'), 20) As bigc) As foo; +--Result + smallinsmall | smallinbig | biginsmall | unioninbig | biginunion | bigisunion +--------------+------------+------------+------------+------------+------------ + t | t | f | t | t | t +(1 row) + + + + + See Also + + +