public void testQuickPolygonUnion() throws Exception { Geometry a = reader.read("POLYGON((0 0, 100 0, 100 100, 0 100, 0 0))"); Geometry b = reader.read("POLYGON((50 50, 150 50, 150 150, 50 150, 50 50))"); Geometry[] polygons = new Geometry[] {a, b}; GeometryCollection polygonCollection = new GeometryFactory().createGeometryCollection(polygons); Geometry union = polygonCollection.buffer(0); System.out.println(union); assertEquals("POLYGON ((0 0, 0 100, 50 100, 50 150, 150 150, 150 50, 100 50, 100 0, 0 0))", union.toString()); }