Replies: 5 comments
-
It's possible this is a bug. Can you provide a reproducer in code? |
Beta Was this translation helpful? Give feedback.
-
So, it looks like we had two 2D polygons. Then we called intersect to create a 3rd polygon. The third polygon is reportedly two dimensional, but it actually has some z points in it. reduce() fails because it doesn't like the mixed 2D and 3D coordinates.
This code snippet doesn't replicated the behavior of intersection() where 2 polygons are passed in and outputs mixed coordinates. I still need to look into that. |
Beta Was this translation helpful? Give feedback.
-
Bear with me, but when I was testing, I noticed that intersected polygons don't always return the same type of coordinates. For example:
Is mixed 2d and 3d points intentional? This doesn't cause an error when calling reduce(), because the Z-axis is NaN. But I'm pretty sure there is one case where Z ends up as 0, instead of NaN, in our code, which does cause a problem when reduce() is called. I'm just having difficulty reproducing it. Anyway, I'll continue investigating. |
Beta Was this translation helpful? Give feedback.
-
That is probably a bug. The handling of coordinate dimensions is complex and still imperfect, unfortunately. |
Beta Was this translation helpful? Give feedback.
-
I was able to get past the last error by flattening my GeometryCollection using a CoordinateOperation and replacing all instances of Coordinate with CoordinateXY. But, then I ran into a new error:
This exception doesn't tell me much, because the original exception gets eaten up by the try/catch in PrecisionReducer.java at line 66. But after debugging some more, I was able to get entire stack trace of the failure:
Apparently, when OverlayNG initializes PolygonBuilder, it assumes the geometry is polygonal for some reason, and then fails when the geometry is not polygonal. Is there a reason for restricting Geometry objects to be polygonal when calling reduce? I used a GeometryCollection in my code, but I see the error still happens when just using a Polygon. See below:
|
Beta Was this translation helpful? Give feedback.
-
We upgraded from JTS 1.16.0 to 1.18.2 and now the following code:
...gives the following error...
Any ideas what could be causing this? It looks like it's looking for Z values in a 2D polygon? Is there something I need to set? geometry.getDimension() returns 2.
Beta Was this translation helpful? Give feedback.
All reactions