public void insertGeometry ( String tableName , Geometry geometry , String epsg ) throws Exception { String epsgStr = "4326" ; if ( epsg == null ) { epsgStr = epsg ; } GeometryColumn gc = getGeometryColumnsForTable ( tableName ) ; String sql = "INSERT INTO " + tableName + " (" + gc . geometryColumnName + ") VALUES (ST_GeomFromText(?, " + epsgStr + "))" ; execOnConnection ( connection -> { try ( IHMPreparedStatement pStmt = connection . prepareStatement ( sql ) ) { pStmt . setString ( 1 , geometry . toText ( ) ) ; pStmt . executeUpdate ( ) ; } return null ; } ) ; }
Insert a geometry into a table .