[postgis-tickets] [PostGIS] #3023: Create ST_ClusterIntersecting / ST_ClusterWithin Functions

PostGIS trac at osgeo.org
Sun Feb 1 14:58:16 PST 2015


#3023: Create ST_ClusterIntersecting / ST_ClusterWithin Functions
-------------------------+--------------------------------------------------
 Reporter:  dbaston      |       Owner:  dbaston      
     Type:  enhancement  |      Status:  new          
 Priority:  medium       |   Milestone:  PostGIS 2.2.0
Component:  postgis      |     Version:  trunk        
 Keywords:               |  
-------------------------+--------------------------------------------------

Comment(by dbaston):

 I've posted an implementation of ST_ClusterIntersecting as a PR on github:
 [https://github.com/postgis/postgis/pull/31]

 I just ran some unscientific benchmarks on my netbook, and I'm surprised
 by how good the performance is.  Using some TIGER water lines
 [ftp://ftp2.census.gov/geo/tiger/TIGER2014/LINEARWATER/tl_2014_50017_linearwater.zip],
 I'm getting clusters in 2-3 seconds, compared to 400-600 seconds using the
 two methods posted at [http://gis.stackexchange.com/q/94203].  Some of the
 lines that look like they _should_ intersect don't according to
 ST_Intersects(), so I actually had to buffer these inputs to get the
 result (watersheds) that I was after.  Shows a need for
 ST_ClusterWithin...

 Some things I am unsure of:

 - I'm always returning an array of GeometryCollections, instead of trying
 to figure out the most restrictive data type (for example, with LineString
 inputs, I could return an array of MultiLineStrings.)  Always returning a
 GC makes the code simpler and the user always knows what to expect; on the
 other hand, this may require the user to convert the GCs into another type
 for downstream processing.

 - Adding clusterintersecting() to lwgeom_geos.h seemed a bit out of place?

 - I don't see the GEOS STRTree used elsewhere in the project, should I be
 accomplishing this some other way?

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/3023#comment:4>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list