From: Daniel Baston Date: Wed, 24 Feb 2016 13:00:16 +0000 (+0000) Subject: Move all ST_Cluster* docs to measurement section X-Git-Tag: 2.3.0beta1~244 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=63bf35e27e3500daa832fc98f8e0a332ce9141ef;p=postgis Move all ST_Cluster* docs to measurement section git-svn-id: http://svn.osgeo.org/postgis/trunk@14677 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/reference_measure.xml b/doc/reference_measure.xml index fabeb9b46..1cf1b7c8c 100644 --- a/doc/reference_measure.xml +++ b/doc/reference_measure.xml @@ -1032,6 +1032,236 @@ SELECT ST_AsText( + + + ST_ClusterDBSCAN + + Windowing function that returns integer id for the cluster each input geometry is in. + + + + + + integer ST_ClusterDBSCAN + + geometry + geom + + float8 + eps + + int + minpoints + + + + + + Description + + Returns cluster number for each input geometry, based on a 2D + implementation of the + DBSCAN + algorithm. An input geometry will be added to a cluster if it is + within eps distance of at least + minpoints other input geometries. + + + + + Examples + + Assigning a cluster number to each parcel point: + + +SELECT parcel_id, ST_ClusterDBSCAN(geom, eps := 0.5, minpoints := 5) over () AS cid +FROM parcels; + + + + + Combining parcels with the same cluster number into a single geometry: + + +SELECT cid, ST_Collect(geom) AS cluster_geom, array_agg(parcel_id) AS ids_in_cluster FROM ( + SELECT parcel_id, ST_ClusterDBSCAN(geom, eps := 0.5, minpoints := 5) over () AS cid, geom + FROM parcels) sq +GROUP BY cid; + + + + + See Also + + , + , + + + + + + + + + ST_ClusterIntersecting + + Aggregate. Returns an array with the connected components of a set of geometries + + + + + + geometry[] ST_ClusterIntersecting + geometry g + + + + + + Description + + ST_ClusterIntersecting is an aggregate function that returns an array of GeometryCollections, where each GeometryCollection represents an interconnected set of geometries. + + Availability: 2.2.0 - requires GEOS + + + + Examples + +WITH testdata AS + (SELECT unnest(ARRAY['LINESTRING (0 0, 1 1)'::geometry, + 'LINESTRING (5 5, 4 4)'::geometry, + 'LINESTRING (6 6, 7 7)'::geometry, + 'LINESTRING (0 0, -1 -1)'::geometry, + 'POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0))'::geometry]) AS geom) + +SELECT ST_AsText(unnest(ST_ClusterIntersecting(geom))) FROM testdata; + +--result + +st_astext +--------- +GEOMETRYCOLLECTION(LINESTRING(0 0,1 1),LINESTRING(5 5,4 4),LINESTRING(0 0,-1 -1),POLYGON((0 0,4 0,4 4,0 4,0 0))) +GEOMETRYCOLLECTION(LINESTRING(6 6,7 7)) + + + + See Also + + , + , + + + + + + + + + + ST_ClusterKMeans + + Windowing function that returns integer id for the cluster each input geometry is in. + + + + + + integer ST_ClusterKMeans + + geometry + geom + + integer + number_of_clusters + + + + + + Description + + Returns 2D distance based + k-means + cluster number for each input geometry. The distance used for clustering is the + distance between the centroids of the geometries. + + + + + Examples + +SELECT ST_ClusterKMeans(geom, 5) over (), geom, parcel_id +FROM parcels; + + + + + See Also + + , + , + + + + + + + + ST_ClusterWithin + + Aggregate. Returns an array of GeometryCollections, where each GeometryCollection represents a set of geometries separated by no more than the specified distance. + + + + + + geometry[] ST_ClusterWithin + geometry g + float8 distance + + + + + + Description + + ST_ClusterWithin is an aggregate function that returns an array of GeometryCollections, where each GeometryCollection represents a set of geometries separated by no more than the specified distance. + + Availability: 2.2.0 - requires GEOS + + + + Examples + +WITH testdata AS + (SELECT unnest(ARRAY['LINESTRING (0 0, 1 1)'::geometry, + 'LINESTRING (5 5, 4 4)'::geometry, + 'LINESTRING (6 6, 7 7)'::geometry, + 'LINESTRING (0 0, -1 -1)'::geometry, + 'POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0))'::geometry]) AS geom) + +SELECT ST_AsText(unnest(ST_ClusterWithin(geom, 1.4))) FROM testdata; + +--result + +st_astext +--------- +GEOMETRYCOLLECTION(LINESTRING(0 0,1 1),LINESTRING(5 5,4 4),LINESTRING(0 0,-1 -1),POLYGON((0 0,4 0,4 4,0 4,0 0))) +GEOMETRYCOLLECTION(LINESTRING(6 6,7 7)) + + + + See Also + + , + , + + + + + + ST_Contains @@ -4160,117 +4390,6 @@ SELECT ST_Buffer(ST_GeomFromText('POINT(50 50)'), 20) As smallc, , , - - - - ST_ClusterDBSCAN - - Windowing function that returns integer id for the cluster each input geometry is in. - - - - - - integer ST_ClusterDBSCAN - - geometry - geom - - float8 - eps - - int - minpoints - - - - - - Description - - Returns cluster number for each input geometry, based on a 2D - implementation of the - DBSCAN - algorithm. An input geometry will be added to a cluster if it is - within eps distance of at least - minpoints other input geometries. - - - - - Examples - - Assigning a cluster number to each parcel point: - - -SELECT parcel_id, ST_ClusterDBSCAN(geom, eps := 0.5, minpoints := 5) over () AS cid -FROM parcels; - - - - - Combining parcels with the same cluster number into a single geometry: - - -SELECT cid, ST_Collect(geom) AS cluster_geom, array_agg(parcel_id) AS ids_in_cluster FROM ( - SELECT parcel_id, ST_ClusterDBSCAN(geom, eps := 0.5, minpoints := 5) over () AS cid, geom - FROM parcels) sq -GROUP BY cid; - - - - - See Also - - - - - - - - - ST_ClusterKMeans - - Windowing function that returns integer id for the cluster each input geometry is in. - - - - - - integer ST_ClusterKMeans - - geometry - geom - - integer - number_of_clusters - - - - - - Description - - Returns 2D distance based - k-means - cluster number for each input geometry. The distance used for clustering is the - distance between the centroids of the geometries. - - - - - Examples - -SELECT ST_ClusterKMeans(geom, 5) over (), geom, parcel_id -FROM parcels; - - - - - See Also - - - diff --git a/doc/reference_processing.xml b/doc/reference_processing.xml index 11dd8855a..23c154fb2 100644 --- a/doc/reference_processing.xml +++ b/doc/reference_processing.xml @@ -416,113 +416,6 @@ SELECT ST_ClipByBox2D(the_geom, ST_MakeEnvelope(0,0,10,10)) FROM mytab; - - - ST_ClusterIntersecting - - Aggregate. Returns an array with the connected components of a set of geometries - - - - - - geometry[] ST_ClusterIntersecting - geometry g - - - - - - Description - - ST_ClusterIntersecting is an aggregate function that returns an array of GeometryCollections, where each GeometryCollection represents an interconnected set of geometries. - - Availability: 2.2.0 - requires GEOS - - - - Examples - -WITH testdata AS - (SELECT unnest(ARRAY['LINESTRING (0 0, 1 1)'::geometry, - 'LINESTRING (5 5, 4 4)'::geometry, - 'LINESTRING (6 6, 7 7)'::geometry, - 'LINESTRING (0 0, -1 -1)'::geometry, - 'POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0))'::geometry]) AS geom) - -SELECT ST_AsText(unnest(ST_ClusterIntersecting(geom))) FROM testdata; - ---result - -st_astext ---------- -GEOMETRYCOLLECTION(LINESTRING(0 0,1 1),LINESTRING(5 5,4 4),LINESTRING(0 0,-1 -1),POLYGON((0 0,4 0,4 4,0 4,0 0))) -GEOMETRYCOLLECTION(LINESTRING(6 6,7 7)) - - - - See Also - - , - - - - - - - - ST_ClusterWithin - - Aggregate. Returns an array of GeometryCollections, where each GeometryCollection represents a set of geometries separated by no more than the specified distance. - - - - - - geometry[] ST_ClusterWithin - geometry g - float8 distance - - - - - - Description - - ST_ClusterWithin is an aggregate function that returns an array of GeometryCollections, where each GeometryCollection represents a set of geometries separated by no more than the specified distance. - - Availability: 2.2.0 - requires GEOS - - - - Examples - -WITH testdata AS - (SELECT unnest(ARRAY['LINESTRING (0 0, 1 1)'::geometry, - 'LINESTRING (5 5, 4 4)'::geometry, - 'LINESTRING (6 6, 7 7)'::geometry, - 'LINESTRING (0 0, -1 -1)'::geometry, - 'POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0))'::geometry]) AS geom) - -SELECT ST_AsText(unnest(ST_ClusterWithin(geom, 1.4))) FROM testdata; - ---result - -st_astext ---------- -GEOMETRYCOLLECTION(LINESTRING(0 0,1 1),LINESTRING(5 5,4 4),LINESTRING(0 0,-1 -1),POLYGON((0 0,4 0,4 4,0 4,0 0))) -GEOMETRYCOLLECTION(LINESTRING(6 6,7 7)) - - - - See Also - - , - - - - - ST_Collect