I have list of geometry type in a database or:

List<com.vividsolutions.jts.geom.Polygon> polygons

Is there any JTS Topology Suite method or PostGIS function which would output intersecting groups as unions of Polygon?

For example, if I provide list of polygons(boxes) like below, I would expect to get list of unions: one made of 1, 2, 10 boxes, another of 5,7, etc.

enter image description here

  • Are the boxes numbered as 1, 2, 3... the envelopes of the MultiPoints? – user30184 Oct 16 '17 at 12:39
  • I would expect output - list of unions - one made of 1-2-10 boxes, another of 4-9-8 and so forth. – Justas Oct 16 '17 at 12:49
  • You did not answer my question. – user30184 Oct 16 '17 at 13:04
  • Boxes are different MultiPoint objects. – Justas Oct 16 '17 at 13:10
  • 1
    Please try to analyze your case and formulate it then as an understandable question. – user30184 Oct 16 '17 at 14:09

Found PostGIS function which solves the problem:

ST_ClusterIntersecting — Aggregate. Returns an array with the connected components of a set of geometries

ST_ClusterIntersecting is an aggregate function that returns an array of GeometryCollections, where each GeometryCollection represents an interconnected set of geometries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.