locationtech / jts

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

Trying to use GeoServer and it seems the error comes back to Coordinate.setM #1026

Open djzielin opened 10 months ago

djzielin commented 10 months ago

Here is the trace.

java.lang.IllegalArgumentException: Invalid ordinate index: 3 at org.locationtech.jts.geom.Coordinate.setM(Coordinate.java:218) at org.locationtech.jts.geom.impl.PackedCoordinateSequence.getCoordinate(PackedCoordinateSequence.java:116) at org.locationtech.jts.operation.predicate.RectangleIntersectsSegmentVisitor.checkIntersectionWithSegments(RectangleIntersects.java:327) at org.locationtech.jts.operation.predicate.RectangleIntersectsSegmentVisitor.checkIntersectionWithLineStrings(RectangleIntersects.java:317) at org.locationtech.jts.operation.predicate.RectangleIntersectsSegmentVisitor.visit(RectangleIntersects.java:310) at org.locationtech.jts.geom.util.ShortCircuitedGeometryVisitor.applyTo(ShortCircuitedGeometryVisitor.java:35) at org.locationtech.jts.operation.predicate.RectangleIntersects.intersects(RectangleIntersects.java:110) at org.locationtech.jts.operation.predicate.RectangleIntersects.intersects(RectangleIntersects.java:58) at org.locationtech.jts.geom.Geometry.intersects(Geometry.java:754) at org.geotools.filter.spatial.BBOXImpl.basicEvaluate(BBOXImpl.java:118) at org.geotools.filter.spatial.BBOXImpl.evaluateInternal(BBOXImpl.java:107) at org.geotools.filter.GeometryFilterImpl.evaluate(GeometryFilterImpl.java:217) at org.geotools.data.shapefile.ShapefileFeatureReader.buildFeature(ShapefileFeatureReader.java:263) at org.geotools.data.shapefile.IndexedShapefileFeatureReader.hasNext(IndexedShapefileFeatureReader.java:100) at org.geotools.data.ReTypeFeatureReader.hasNext(ReTypeFeatureReader.java:191) at org.geotools.data.MaxFeatureReader.hasNext(MaxFeatureReader.java:82) at org.geotools.data.store.ContentFeatureCollection.size(ContentFeatureCollection.java:241) at org.geotools.data.crs.ReprojectFeatureResults.size(ReprojectFeatureResults.java:107) at org.geotools.feature.collection.DecoratingFeatureCollection.size(DecoratingFeatureCollection.java:113) at org.geoserver.wfs.GetFeature.run(GetFeature.java:540)

dr-jts commented 10 months ago

This looks like it might be a GeoServer bug, not a JTS bug. Based on:

https://gis.stackexchange.com/questions/362671/geoserver-2-17-added-shapefile-with-geometry-of-type-3d-polygon-rendering-f https://osgeo-org.atlassian.net/browse/GEOT-6599

From that last ticket it sounds like GeoServer is creating a PackedCoordinateSequence with dimensions = 2 and measures = 1. This is an error (dimensions should be at least 3). JTS does have a sanity check for this - not sure why that is not triggered in this case.

jodygarnett commented 1 month ago

Is it worth closing these bugs against downstream software? GEOT-6599 is now closed