unionGeom method

Geometry unionGeom(
  1. Geometry other
)

Computes a Geometry representing the point-set which is contained in both this Geometry and the other Geometry.

The union of two geometries of different dimension produces a result geometry of dimension equal to the maximum dimension of the input geometries. The result geometry may be a heterogeneous {@link GeometryCollection}. If the result is empty, it is an atomic geometry with the dimension of the highest input dimension.

Unioning {@link LineString}s has the effect of noding and dissolving the input linework. In this context "noding" means that there will be a node or endpoint in the result for every endpoint or line segment crossing in the input. "Dissolving" means that any duplicate (i.e. coincident) line segments or portions of line segments will be reduced to a single line segment in the result. If merged linework is required, the {@link LineMerger} class can be used.

Non-empty {@link GeometryCollection} arguments are not supported.

@param other the Geometry with which to compute the union @return a point-set combining the points of this Geometry and the points of other @throws TopologyException if a robustness error occurs @throws IllegalArgumentException if either input is a non-empty GeometryCollection @see LineMerger

Implementation

Geometry unionGeom(Geometry other) {
  throw UnimplementedError("Not implemented yet"); // TODO
//    // handle empty geometry cases
//    if (this.isEmpty() || other.isEmpty()) {
//      if (this.isEmpty() && other.isEmpty())
//        return OverlayOp.createEmptyResult(OverlayOp.UNION, this, other, factory);
//
//      // special case: if either input is empty ==> other input
//      if (this.isEmpty()) return other.copy();
//      if (other.isEmpty()) return copy();
//    }
//
//    // TODO: optimize if envelopes of geometries do not intersect
//
//    checkNotGeometryCollection(this);
//    checkNotGeometryCollection(other);
//    return SnapIfNeededOverlayOp.overlayOp(this, other, OverlayOp.UNION);
}