[Geoserver-users] Problems with shapefile geometry with 3/4 dimension (WFS/WPS only)

Hi all,
I’m experiencing problems querying with WFS’s GetFeature layers based on shapefile with geometry with more than 2 dimensions.

My test environment:

  • Windows 10, Tomcat 9.0.54, Java jdk-11.0.12.7-hotspot (Adoptium by Eclipse Foundation)

My test data

  • polygonal shapefile elaborated with ogr2ogr to produce 2D, 3D (xyz & xym) and 4D geometry (xyzm). The original shapefile was a 4D geometry coming from ESRI’s applications.
  • ogr2ogr -dim XYZM OrigEdificiXYZM.shp EdificiXYZM.shp
  • ogr2ogr -dim XYZ OrigEdificiXYZM.shp EdificiXYZ.shp
  • ogr2ogr -dim XYM OrigEdificiXYZM.shp EdificiXYM.shp
  • ogr2ogr -dim XY OrigEdificiXYZM.shp EdificiXY.shp

My test query:
http://localhost:8089/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typeName=common:EdificiXYM&bbox=493318, 5048991, 493319, 5048992&srsName=EPSG:32632

I launched with PostMan the WFS GetFeature with a bbox filter and I got this results on different version of GeoServer:



GeoServer



3D (XYZ/XYM)



4D (XYZM)



2D (XY)



2.20.0



O



O



ü



2.19.3



O



O



ü



2.18.5



O



O



ü



2.17.5



O



O



ü



2.16.5



ü



ü



ü



2.16.0



ü



ü



ü

The XYZM and XYZ test cases give the same error "Invalid ordinate index: 3."
Excerpt from logfile:
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)

The XYM test case gives an "Index 69 out of bounds for length 69"

Excerpt from logfile:

java.lang.ArrayIndexOutOfBoundsException: Index 69 out of bounds for length 69
at org.geotools.geometry.jts.LiteCoordinateSequence.setOrdinate(LiteCoordinateSequence.java:224)
at org.geotools.data.shapefile.shp.PolygonHandler.readCoordinates(PolygonHandler.java:315)
at org.geotools.data.shapefile.shp.PolygonHandler.read(PolygonHandler.java:142)
at org.geotools.data.shapefile.shp.ShapefileReader$Record.shape(ShapefileReader.java:114)
at org.geotools.data.shapefile.ShapefileFeatureReader.getGeometry(ShapefileFeatureReader.java:239)
at org.geotools.data.shapefile.IndexedShapefileFeatureReader.hasNext(IndexedShapefileFeatureReader.java:86)
at org.geotools.data.ReTypeFeatureReader.hasNext(ReTypeFeatureReader.java:191)
at org.geotools.data.MaxFeatureReader.hasNext(MaxFeatureReader.java:82)

WMS GetMap works fine with all types of geometries.

It’s clearly a GeoTools error and though I found information about this having been already solved (https://osgeo-org.atlassian.net/browse/GEOT-6599) I’m still having issues.

Stefano

Someone else was mentioning issues with LiteCoordinateSequence, I have not had an opportunity to look at it yet.

Jody

···


Jody Garnett

This has been going on for a while, snowballing… a number of different developers
have been providing patches during the last few years, each time adding tests, and each
time apparently fixing something but breaking something else.
It seems we did not have enough tests covering M and Z, and we still do not,
despite the fair number of test methods in here:
https://github.com/geotools/geotools/blob/main/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/shp/ZMHandlersTest.java

Please open a ticket, attach a sample shapefile along with requests that make the system fail.
Hopefully it will be picked up during one of the future bug fix code sprints.

Cheers
Andrea

···

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 333 8128928

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail

Thank you Andrea,
I’ve just created a ticket GEOS-10290 attaching data and WFS requests.

Stefano

On Thu, Oct 28, 2021 at 9:48 AM Andrea Aime <andrea.aime@anonymised.com> wrote:

This has been going on for a while, snowballing… a number of different developers
have been providing patches during the last few years, each time adding tests, and each
time apparently fixing something but breaking something else.
It seems we did not have enough tests covering M and Z, and we still do not,
despite the fair number of test methods in here:
https://github.com/geotools/geotools/blob/main/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/shp/ZMHandlersTest.java

Please open a ticket, attach a sample shapefile along with requests that make the system fail.
Hopefully it will be picked up during one of the future bug fix code sprints.

Cheers
Andrea

On Wed, Oct 27, 2021 at 10:16 AM stefano pezzi <stefanopezzi@anonymised.com> wrote:

Hi all,
I’m experiencing problems querying with WFS’s GetFeature layers based on shapefile with geometry with more than 2 dimensions.

My test environment:

  • Windows 10, Tomcat 9.0.54, Java jdk-11.0.12.7-hotspot (Adoptium by Eclipse Foundation)

My test data

  • polygonal shapefile elaborated with ogr2ogr to produce 2D, 3D (xyz & xym) and 4D geometry (xyzm). The original shapefile was a 4D geometry coming from ESRI’s applications.
  • ogr2ogr -dim XYZM OrigEdificiXYZM.shp EdificiXYZM.shp
  • ogr2ogr -dim XYZ OrigEdificiXYZM.shp EdificiXYZ.shp
  • ogr2ogr -dim XYM OrigEdificiXYZM.shp EdificiXYM.shp
  • ogr2ogr -dim XY OrigEdificiXYZM.shp EdificiXY.shp

My test query:
http://localhost:8089/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typeName=common:EdificiXYM&bbox=493318, 5048991, 493319, 5048992&srsName=EPSG:32632

I launched with PostMan the WFS GetFeature with a bbox filter and I got this results on different version of GeoServer:



GeoServer



3D (XYZ/XYM)



4D (XYZM)



2D (XY)



2.20.0



O



O



ü



2.19.3



O



O



ü



2.18.5



O



O



ü



2.17.5



O



O



ü



2.16.5



ü



ü



ü



2.16.0



ü



ü



ü

The XYZM and XYZ test cases give the same error "Invalid ordinate index: 3."
Excerpt from logfile:
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)

The XYM test case gives an "Index 69 out of bounds for length 69"

Excerpt from logfile:

java.lang.ArrayIndexOutOfBoundsException: Index 69 out of bounds for length 69
at org.geotools.geometry.jts.LiteCoordinateSequence.setOrdinate(LiteCoordinateSequence.java:224)
at org.geotools.data.shapefile.shp.PolygonHandler.readCoordinates(PolygonHandler.java:315)
at org.geotools.data.shapefile.shp.PolygonHandler.read(PolygonHandler.java:142)
at org.geotools.data.shapefile.shp.ShapefileReader$Record.shape(ShapefileReader.java:114)
at org.geotools.data.shapefile.ShapefileFeatureReader.getGeometry(ShapefileFeatureReader.java:239)
at org.geotools.data.shapefile.IndexedShapefileFeatureReader.hasNext(IndexedShapefileFeatureReader.java:86)
at org.geotools.data.ReTypeFeatureReader.hasNext(ReTypeFeatureReader.java:191)
at org.geotools.data.MaxFeatureReader.hasNext(MaxFeatureReader.java:82)

WMS GetMap works fine with all types of geometries.

It’s clearly a GeoTools error and though I found information about this having been already solved (https://osgeo-org.atlassian.net/browse/GEOT-6599) I’m still having issues.

Stefano


Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 333 8128928

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail