code: public static Geometry convert(org.postgis.Geometry geometry) {
          switch (geometry.getType()) {
          case org.postgis.Geometry.POINT:
              return convert((org.postgis.Point) geometry);
          case org.postgis.Geometry.LINESTRING:
              return convert((org.postgis.LineString) geometry);
          case org.postgis.Geometry.LINEARRING:
              return convert((org.postgis.LinearRing) geometry);
          case org.postgis.Geometry.POLYGON:
              return convert((org.postgis.Polygon) geometry);
          case org.postgis.Geometry.MULTILINESTRING:
              return convert((org.postgis.MultiLineString) geometry);
          case org.postgis.Geometry.MULTIPOINT:
              return convert((org.postgis.MultiPoint) geometry);
          case org.postgis.Geometry.MULTIPOLYGON:
              return convert((org.postgis.MultiPolygon) geometry);
          case org.postgis.Geometry.GEOMETRYCOLLECTION:
              return convert((org.postgis.GeometryCollection) geometry);
          }
          throw new IllegalArgumentException(geometry.toString());
      }
docs: to geolatte