locationtech / jts

The JTS Topology Suite is a Java library for creating and manipulating vector geometry.
Other
1.96k stars 440 forks source link

TopologyException using UnaryUnionNG.Union with a floating PrecisionModel #752

Open FObermaier opened 3 years ago

FObermaier commented 3 years ago

The following issue was reported for NTS: https://github.com/NetTopologySuite/NetTopologySuite/issues/531

Possible fixes are:

dr-jts commented 3 years ago

Thanks, will look at this ASAP.

The idea of using OverlayNGRobust.union(Geometry) in the case of a Floating PrecisionModel makes sense.

This might also reveal a bug in GeometryStrategy.union(Geometry) - not sure it uses a fixed PrecisionModel even if the Geometry PM is fixed.

dr-jts commented 3 years ago

In JTS UnaryUnionOp there is a warning that it works only for fixed-precision inputs, and that OverlayNGRobust should be used in that case.

I'm leery of promoting too many alternative code paths through the overlay code. It's confusing enough as it is. I guess this really requires an IllegalArgumentException to be thrown, however.