Search code examples
polygongeotools

Error loading polygon geometries using shape file data store with geotools 24.0


I have recently upgraded my geotools dependencies from 23.2 to 24.0 i have the following error when i try to load a FeatureCollection from a shape file data store with a polygon geometry,seems this problem was introduced in 24.0 geotools release ,anyone now how to solve this problem please

java.lang.NoSuchMethodError: org.locationtech.jts.geom.Polygon.getExteriorRing()Lorg/locationtech/jts/geom/LineString;

Solution

  • GeoTools upgraded to version 1.17.0 of JTS with version 24.0 - this changed the return type of the getExteriorRing to LinearRing from LineString. This is supposed to be only a binary change so you should be able to handle it by just recompiling the code that uses that method.