Friday, October 07, 2005

JST Robust issue

JTS union may *not* be commutative or associative in the strict sense. In other words, different ordering of the operands may produce slightly different results. This is an unavoidable result of using finite-precision arithmetic to compute operations which inherently require higher precision.

The difference should normally be *very* minor, however. The one time this is not the case is when the first operation produces a robustness error. In this case obviously the two results can be very different (e.g. an exception, versus an actual return value).

> Is this simply a bug that has been fixed?

Yes, this probably reflects an improvement that was made in the intersection calculation.

> Should a union of two valid Geometry's always yield a valid Geometry?

Yes, if the operation completes successfully, the result will always be a valid Geometry. Unfortunately, in the current implementation, sometimes overlay operations can also result in robustness errors. (This is something I'm hoping to fix in a future release).

I notice that your data seems to be fairly limited in precision. You might try using a fixed precision model - this can sometimes alleviate robustness problems.

Martin Davis, Senior Technical Architect
Vivid Solutions Inc. www.vividsolutions.com
Suite #1A-2328 Government Street Victoria, B.C. V8T 5G5
Phone: (250) 385 6040 - Local 308 Fax: (250) 385 6046

No comments: