[postgis-tickets] r14676 - Add doc entry for ST_ClusterDBSCAN

Daniel Baston dbaston at gmail.com
Wed Feb 24 04:48:55 PST 2016


Author: dbaston
Date: 2016-02-24 04:48:55 -0800 (Wed, 24 Feb 2016)
New Revision: 14676

Modified:
   trunk/doc/reference_measure.xml
Log:
Add doc entry for ST_ClusterDBSCAN

Modified: trunk/doc/reference_measure.xml
===================================================================
--- trunk/doc/reference_measure.xml	2016-02-24 11:40:55 UTC (rev 14675)
+++ trunk/doc/reference_measure.xml	2016-02-24 12:48:55 UTC (rev 14676)
@@ -4160,12 +4160,78 @@
 		<para><xref linkend="ST_Contains"/>, <xref linkend="ST_Equals"/>, <xref linkend="ST_IsValid"/></para>
 	  </refsection>
 	</refentry>
+
+    <refentry id="ST_ClusterDBSCAN">
+	  <refnamediv>
+		<refname>ST_ClusterDBSCAN</refname>
+
+        <refpurpose>Windowing function that returns integer id for the cluster each input geometry is in.</refpurpose>
+    </refnamediv>
+
+	  <refsynopsisdiv>
+		<funcsynopsis>
+		  <funcprototype>
+			<funcdef>integer <function>ST_ClusterDBSCAN</function></funcdef>
+
+			<paramdef><type>geometry </type>
+			<parameter>geom</parameter></paramdef>
+
+			<paramdef><type>float8 </type>
+			<parameter>eps</parameter></paramdef>
+
+			<paramdef><type>int </type>
+			<parameter>minpoints</parameter></paramdef>
+		  </funcprototype>
+		</funcsynopsis>
+	  </refsynopsisdiv>
+
+	  <refsection>
+      <title>Description</title>
+
+      <para>Returns cluster number for each input geometry, based on a 2D 
+          implementation of the 
+          <ulink url="https://en.wikipedia.org/wiki/DBSCAN">DBSCAN</ulink> 
+          algorithm.  An input geometry will be added to a cluster if it is 
+          within <varname>eps</varname> distance of at least
+          <varname>minpoints</varname> other input geometries.
+      </para>
+    </refsection>
+
+    <refsection>
+      <title>Examples</title>
+      <para>
+          Assigning a cluster number to each parcel point:
+      </para>
+		    <programlisting>
+SELECT parcel_id, ST_ClusterDBSCAN(geom, eps := 0.5, minpoints := 5) over () AS cid
+FROM parcels;
+</programlisting>
+
+
+        <para>
+            Combining parcels with the same cluster number into a single geometry:
+        </para>
+		    <programlisting>
+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;
+</programlisting>
+    </refsection>
+
+    <refsection>
+		  <title>See Also</title>
+      <para><xref linkend="ST_ClusterKMeans"/></para>
+	  </refsection>
+
+    </refentry>
+
   
 	<refentry id="ST_ClusterKMeans">
 	  <refnamediv>
 		<refname>ST_ClusterKMeans</refname>
 
-		<refpurpose>Windowing function that returns integer for cluster each input geometry is in.</refpurpose>
+		<refpurpose>Windowing function that returns integer id for the cluster each input geometry is in.</refpurpose>
 	  </refnamediv>
 
 	  <refsynopsisdiv>
@@ -4202,8 +4268,7 @@
 
     <refsection>
 		  <title>See Also</title>
-      <!-- <para><xref linkend="ST_ClusterDBSCAN"/></para> -->
-      <para>See also ST_ClusterDBSCAN</para>
+      <para><xref linkend="ST_ClusterDBSCAN"/></para>
 	  </refsection>
 	</refentry>  
   



More information about the postgis-tickets mailing list