Issue Details (XML | Word | Printable)

Key: TEST-20
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Baris ERGUN
Reporter: Baris ERGUN
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
Test Framework

testGeometryCollectionMMapping of org.datanucleus.tests.PgGeometryPostGISExtMappingTest failure

Created: 21/Dec/13 10:55 AM   Updated: 11/Apr/14 09:12 AM  Due: 25/Dec/13
Component/s: None
Affects Version/s: 3.0
Fix Version/s: 4.0

Datastore: PostgreSQL
Severity: Development

 Description  « Hide
testGeometryCollectionMMapping of org.datanucleus.tests.PgGeometryPostGISExtMappingTest fails with below error.

testGeometryCollectionMMapping[default](org.datanucleus.tests.PgGeometryPostGISExtMappingTest) Time elapsed: 0.077 sec <<< ERROR!
javax.jdo.JDODataStoreException: Insert of object "org.datanucleus.samples.pggeometry.SampleGeometryCollectionM@1d7fe3d" using statement "INSERT INTO samplepggeometrycollectionm (id,geom,"name") VALUES (?,?,?)" failed : ERROR: can not mix dimensionality in a geometry
  Hint: "...100,55 55 100,45 55 100,45 45 100)))" <-- parse error at position 183 within geometry
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(
at org.postgresql.core.v3.QueryExecutorImpl.processResults(
at org.postgresql.core.v3.QueryExecutorImpl.execute(
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(
at org.datanucleus.state.JDOStateManager.internalMakePersistent(
at org.datanucleus.state.JDOStateManager.makePersistent(
at org.datanucleus.ExecutionContextImpl.persistObjectInternal(
at org.datanucleus.ExecutionContextImpl.persistObjectWork(
at org.datanucleus.ExecutionContextImpl.persistObject(
at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(
at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(
at org.datanucleus.tests.PgGeometryPostGISExtMappingTest.testGeometryCollectionMMapping(

The detected root cause is: org.postgis.GeometryCollection constructor

GeometryCollection coll = new GeometryCollection(
                            "SRID=-1;GEOMETRYCOLLECTIONM(POINTM(10 10 100),LINESTRINGM(0 50 100, 100 50 100),POLYGONM((25 25 100,75 25 100,75 75 100,25 75 100,25 25 100),(45 45 100,55 45 100,55 55 100,45 55 100,45 45 100)))"));

when I reprint the coll.toString() I see that my geom string is changed to below :

"SRID=-1;GEOMETRYCOLLECTIONM(POINT(10 10 100),LINESTRING(0 50 100, 100 50 100),POLYGON((25 25 100,75 25 100,75 75 100,25 75 100,25 25 100),(45 45 100,55 45 100,55 55 100,45 55 100,45 45 100)))"

As you can see GEOMETRYCOLLECTIONM is preserved but POINTM LINESTRINGM and POLYGONM is changed to POINT LINESTRING and POLYGON . And because of this I get cannot mix dimensionality when I am trying to insert this geom to database.

I have tried this with postgis jdbc driver 1.1.5; 1.3.3 and 2.0.1 versions.

I will be discussing with Postgis guys and looking for a resolution for this.

Sort Order: Ascending order - Click to sort in descending order
Baris ERGUN added a comment - 21/Dec/13 08:49 PM
I have tested with latest snapshot of postgis-jdbc jar which is 2.1.0SVN. The same problem persists in GeometryCollection class constructor. There was a similar issue solved in past for postgis server side extension

There is constructor which u explicitly enable MMaping "boolean haveM" but that one doesnt resolve as well. When u read java codes it is same as specifying GEOMETRYCOLLECTIONM with letter "M" in String value.

I am trying to push Postgis guys about the problem over mailing list. If we can come to an agreement with them I will update the issue.