|
From: Diego J. <die...@gm...> - 2011-10-18 11:30:27
|
Hi!
I'm trying to write a geometry to a postgis database which has a
constraint that only allows 4D coordinates:
CONSTRAINT enforce_dims_the_geom CHECK (st_ndims(the_geom) = 4
I'm using a a GeometryFactory to create my geometries and I have tried
to set a hint:
GeometryFactory factory = JTSFactoryFinder.getGeometryFactory(new
Hints(Hints.COORDINATE_DIMENSION, new Integer(4)));
Geometry geom = factory.createPoint(new Coordinate(100, 101, 102));
However, this does not work and postgres complains with a:
new row for relation "Geometry" violates check constraint
"enforce_dims_the_geom".
I need to write the data with a Postgresql Connection and so I did:
WKBWriter writer = new WKBWriter();
PreparedStatement st = con.prepareStatement("INSERT INTO
\""+TABLE_NAME+"\" " +
"("+THE_GEOM+") " +
"VALUES (?)",
PreparedStatement.RETURN_GENERATED_KEYS);
st.setBytes(1, writer.write(g.mGeometry));
How can I write the geometry with 4D coordinates?
Thanks
|