Hello, I'm using the Java Topology Suite (JTS) and I want to store geometries with PostGIS. How do I do that?
What works: statement = conn.prepareStatement("INSERT INTO sometable (geofield) values (?)"); org.postgis.PGgeometry m = new org.postgis.PGgeometry(myJtsGeometry.toText()); statement.setObject(1, m); statement.execute(); What I would prefer: statement.setObject(1, myJtsGeometry); statement.execute(); According to http://postgis.refractions.net/documentation/javadoc/org/postgis/DriverWrapper.html, the DriverWrapper is supposed to take care of the wrapping. However, even when I add DriverWrapper.addGISTypes80((org.postgresql.PGConnection)conn); I get the error message Can't infer the SQL type to use for an instance of com.vividsolutions.jts.geom.MultiPolygon. Use setObject() with an explicit Types value to specify the type to use. I am connecting to jdbc:postgresql_postGIS://localhost:5432/ The driver class is org.postgis.DriverWrapper What am I missing? Or is the first, working way the right one? Seems like a waste of time to me, converting binary -> text -> binary... Thanks Nicolas _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users