postgisgeotoolsjts

postgis-jdbc-jtsparser and geotools incompatiblity?


I am trying to use postgis-jdbc-jtsparser with geotools gt-epsg-hsql - the following being taken from my sbt file (same data as relevant maven declarations

val postgisJts = "net.postgis" % "postgis-jdbc-jtsparser" % "2.5.0"
val `gt-main` = "org.geotools" % "gt-main" % "24.0"
val `gt-epsg-hsql` = "org.geotools" % "gt-epsg-hsql" % "24.0"

On running my tests I get this error:

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

And looking into it it seems postgis is using jts 1.16.1 or later whereas geotools is down on 1.13.0

Presumably the getExteriorRing got changed at some point. We are using latest postgres/postgis versions.

Is this a known problem? Is there any simple resolution? We're only using geotools for grid reference conversion (via hsql library)


Solution

  • GeoTools moved from 1.16 to 1.17 on July 8th 2020, so you need to make sure you are using a version from before that, which if I'm reading the git history correctly is a 23.x version.