I have uploaded in H2 a new datatype named geometry. Now you can
create a spatial table like this :
CREATE TABLE mytable(gid int, the_geom geometry);
The table is populated with this function :
INSERT INTO mytable VALUES(1, GEOMFROMTEXT('POINT(1 1)', -1));
You can also use spatial operators and predicates like in postgis.
Look at : http://geosysin.iict.ch/irstv-trac/wiki/H2spatial/Download
Nevertheless, I have a problem with the function create table link.
When I import a postgres table with a field geometry the value is
transformed in another datatype . Great.
But, the values from postgres to H2 are quite different. In H2 I have
186 bytes but in Postgres I have 21 bytes.
Do you have an idea ?
Thanks
R1.
> When I import a postgres table with a field geometry the value is
> transformed in another datatype . Great.
> But, the values from postgres to H2 are quite different. In H2 I have
> 186 bytes but in Postgres I have 21 bytes.
I'm not sure, maybe PostgreSQL stores it in a binary format, and H2
stores it as a serialized Java object (PostgreSQL doesn't understand
serialized Java objects). Maybe the object should be stored in H2 in
the same binary format as PostgreSQL to be compatible, but this is
just a guess. I'm not sure how to solve this, sorry.
Thomas
The geometry is stored in a binary format . When I insert my value in
H2 with GEOMFROMTEXT() function the value is the same than in
Postgres. I don't understand why when the table is linked from
postgres to H2 the value change.
If I used the jdbc postgres driver without H2 I have not such a
problem.
R1.
On 19 mar, 22:58, "Thomas Mueller" <thomas.tom.muel...@gmail.com>
wrote:
Here my method :
Create a geometry table in postgres with a point
CREATE TABLE onepoint (id int, the_geom geometry);
INSERT INTO onepoint VALUES(1, GEOMFROMTEXT('POINT(1 1)', -1));
Result in Postgres for the geometry value :
0101000000000000000000F03F000000000000F03F
When I create a link in H2, the geometry value is :
303130313030303030303030303030303030303030304630334630303030303030303030303046303346
Thanks
R1.
On 24 mar, 04:10, "Thomas Mueller" <thomas.tom.muel...@gmail.com>
wrote:
> Hi,
> Sorry, I don't fully understand what the problem is. Could you send me
> a test case (with expected result) so that I understand how to
> reproduce it please?
> Thanks,
> Thomas
>
Do you have any idea to solve my problem?
Thanks
R1.
Firsly, i'd like to say I'm very interested in your attempt to make a
Geographic database from H2 (but you already know that :-))
I've no answer about your problem, but just a remark about your data
representation
the first line is the hex representation on an object (the wkb
representation of your geometry I guess)
the second line represents integer values of each character in the
first line...
Hope that helps
Michaël