3

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;
Ian Turton
  • 10,018
  • 1
  • 28
  • 47
  • That looks like you haven't upgraded your JTS dependency - can you add the dependencies from your pom file – Ian Turton Dec 25 '20 at 10:32
  • I just fix the probleme by adding the jts 1.16.1 dependency to my gradle project compile group: 'org.locationtech.jts', name: 'jts-core', version: '1.16.1' i think the solution is to downgrade the jts version as it does not work with geolatte in recent versions. – Achrouf Abdenour Dec 25 '20 at 10:54
  • I think the issue was with the Incompatibility between geolatte-geom 1.6.0 and jts-core 1.17.0,i recently read un article about that : https://gitmemory.com/issue/GeoLatte/geolatte-geom/111/655654867,the cause is that The cause is that in version 1.17.0 of JTS the class org.locationtech.jts.geom.Polygon returns a LinearRing instead of a LineString in the method getExteriorRing. – Achrouf Abdenour Dec 25 '20 at 10:59
  • Exactly, so you can't run GeoTools 24.x until GeoLatte upgrades it version of JTS – Ian Turton Dec 25 '20 at 11:06
  • But i am running now geotools 24.0 with jts 1.16.1 it works fine for me. – Achrouf Abdenour Dec 25 '20 at 11:14

1 Answers1

3

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.

Ian Turton
  • 10,018
  • 1
  • 28
  • 47