Follow on to #374 we have found GeoTools test cases producing inconsistent coordinate sequence through a sequence of JTS calls ending in an intersection call.
This is an interesting case using intersection() between mixed dimensions:
- g1 Polygon using
CoordinateXY (footprint polygon from WKB)
- g2 Polygon using
Coordinate (taken from mosaic bounds).
We suspect one of the internal JTS methods in the overlay process path is calling new Coordinate() rather than relying on CoordinateSequence.createCoordinate().
The net effect is closing a LinearRing with a Coordinate when all the other coordinates are CoordinateXY. This produces a CoordinateArraySequence with inconsistent Coordinates, which will start failing when the CoordinateArraySequence constructor is tightened up to check this as in #374.
private boolean polygonOverlap(Geometry g1, Geometry g2) {
// TODO: try to use relate instead
Geometry intersection = g1.intersection(g2);
return intersection != null && intersection.getDimension() == 2;
}
Follow on to #374 we have found GeoTools test cases producing inconsistent coordinate sequence through a sequence of JTS calls ending in an
intersectioncall.This is an interesting case using
intersection()between mixed dimensions:CoordinateXY(footprint polygon from WKB)Coordinate(taken from mosaic bounds).We suspect one of the internal JTS methods in the overlay process path is calling
new Coordinate()rather than relying onCoordinateSequence.createCoordinate().The net effect is closing a LinearRing with a Coordinate when all the other coordinates are CoordinateXY. This produces a CoordinateArraySequence with inconsistent Coordinates, which will start failing when the CoordinateArraySequence constructor is tightened up to check this as in #374.