epsg on table creation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

epsg on table creation

moovida
Dear h2gis team,
I am very new to h2gis and find it really cool.

I am doing some tests and while everything is quite straight forward,
I can't understand how to create a table with a given srid.

All the testcases I have browsed do not define the srid. And the
syntax: the_geom GEOMETRY(MULTIPOLYGON,4326) does not work.

Any hint would be appreciated.
Thanks,
Andrea
Reply | Threaded
Open this post in threaded view
|

Re: epsg on table creation

moovida
I then found it in some testcase. :-)

For reference, here is how it is done:


int srid = 4326; // my srid
TableLocation tableLocation = TableLocation.parse(tableName);
SFSUtilities.addTableSRIDConstraint(connection, tableLocation, srid);

Cheers,
Andrea
Reply | Threaded
Open this post in threaded view
|

Re: epsg on table creation

ebocher
Administrator
Dear Andrea,

My apologizes for the delay, the team is back from summer holidays ;-)

H2GIS doesn't follow the same syntax than POSTGIS to add geometry column.

So you are right, to add a srid constraint you must alter the table

ALTER TABLE myTable ADD CHECK ST_SRID(the_geom)=myEPSGCode

Cheers

Erwan