[postgis-users] GeometryCollection with GEOMETRYCOLLECTIONM, POINTM etc.. value in constructor.

30 views
Skip to first unread message

Baris Ergun

unread,
Dec 18, 2013, 3:20:20 AM12/18/13
to postgi...@lists.osgeo.org
Hello

I create a GeometryCollection as below 

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. 

This is a test written in datanucleus orm for geospatial extensions and the test is run against the below table (create script) in postgresql db.

CREATE TABLE public.samplepggeometrycollectionm
(
  samplepggeometrycollectionm_id integer NOT NULL DEFAULT nextval('samplepggeometrycollectionm_samplepggeometrycollectionm_id_seq'::regclass),
  geom geometry(GeometryCollectionM),
  id bigint NOT NULL,
  name character varying(255),
  CONSTRAINT samplepggeometrycollectionm_pkey PRIMARY KEY (samplepggeometrycollectionm_id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE public.samplepggeometrycollectionm
  OWNER TO postgres;

Awaiting ur suggestions.
-- 
Baris

Rémi Cura

unread,
Dec 18, 2013, 3:35:32 AM12/18/13
to PostGIS Users Discussion
Hey,
using this in sql :
SELECT ST_AsText(ST_GeomFromText(
'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))
)'
))

It gives you the expected output.
I would guess it is the java function you are using that is faulty (the geometrycollection constructer).

Cheers,
Rémi-C


2013/12/18 Baris Ergun <barise...@gmail.com>
_______________________________________________
postgis-users mailing list
postgi...@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

Rémi Cura

unread,
Dec 18, 2013, 3:36:03 AM12/18/13
to PostGIS Users Discussion
Sorry,
output :
GEOMETRYCOLLECTION M (POINT M (10 10 100),LINESTRING M (0 50 100,100 50 100),POLYGON M ((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)))



Cheers,
Rémi-C


2013/12/18 Rémi Cura <remi...@gmail.com>

Baris Ergun

unread,
Dec 18, 2013, 3:53:29 AM12/18/13
to PostGIS Users Discussion
Exactly correct. I also tried to tell that the problem was originated from org.postgis.GeometryCollection constructor. So I posted to here to understand why constructor was behaving like this. This constructor is in postgis-jdbc.jar . Anyone knowing about this problem on the org.postgis.GeometryCollection constructor?

Baris Ergun

unread,
Dec 21, 2013, 4:57:48 AM12/21/13
to PostGIS Users Discussion
Hi Remi;

Who should I get in touch about this issue related to org.postgis.GeometryCollection constructor in postgis jdbc driver.

Thanks.

Baris Ergun

unread,
Dec 21, 2013, 2:31:49 PM12/21/13
to PostGIS Users Discussion
I have tested the issue with latest snapshot 2.1.0SVN for  jdbc driver. The GeometryCollection still cannot parse the String value correctly. There is a similar issue in postgis extension source codes. http://trac.osgeo.org/postgis/ticket/724 

So with the Java based jdbc codes it looks like we hit the same case. If I could report this as a bug to trac I would do it right away but I dont have access to there.

Paul Ramsey

unread,
Dec 23, 2013, 12:30:41 PM12/23/13
to PostGIS Users Discussion
We need patches for Java issues as we have no active JDBC/Java maintainers ATM.

P.

Baris Ergun

unread,
Dec 26, 2013, 5:08:32 PM12/26/13
to PostGIS Users Discussion
Hi Paul;

I have opened http://trac.osgeo.org/postgis/ticket/2588 and added the patch fix there. Please review it and find the reasonings in comments in the issue.

I would like to also correct errors and warnings on pom.xml of jdbc driver this week.

Cheers.
Reply all
Reply to author
Forward
0 new messages