intersection of bounding boxes with && operator

115 views
Skip to first unread message

Oliver Bienert

unread,
Dec 9, 2013, 11:58:19 AM12/9/13
to ge...@googlegroups.com
Hello,

Today I started to set up a geomajas project with hibernate-spatial and h2/geodb. Configuration went smooth so far but then I got an sql syntax error related to the '&&' operator. The statement looks like this (Placeholders replaced by real geometries):

   select GID, GEOM, NAME
   from GEOOBJECT_PA
   where
        (
            (
                GEOM && ?
            )
            and ST_Intersects(GEOM, ?)
        )

The error thrown states:

; expected

When I change the above where clause to:

   select GID, GEOM, NAME
   from GEOOBJECT_PA
   where
        (
            ST_BBox(GEOM, ?)
            and ST_Intersects(GEOM, ?)
        )

everything runs fine.
But because this statement is generated somewhere in geomajas or hibernate, I'm stuck for now.
The h2 grammar docs mentions the '&&' operator for geometries but it does not seem to work?

Regards Oliver


Justin Deoliveira

unread,
Dec 9, 2013, 12:06:47 PM12/9/13
to ge...@googlegroups.com
Hi Oliver,

Where does it mention that the "&&" operator is supported? That would actually be news to me. Unfortunately afaik h2 doesn't give us the ability to create or overload any operators for geometry types.

-Justin


--
You received this message because you are subscribed to the Google Groups "geodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geodb+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Justin Deoliveira
Vice President, Engineering | Boundless
jdeo...@boundlessgeo.com
@j_deolive
Message has been deleted
Message has been deleted

Oliver Bienert

unread,
Dec 11, 2013, 12:34:51 PM12/11/13
to ge...@googlegroups.com
Google keeps deleting my posts...

One more try:

I found it in the docs at h2 webpage, under SQL grammar, and there the operator is listed under 'compare'.

Oliver

Justin Deoliveira

unread,
Dec 11, 2013, 12:43:08 PM12/11/13
to ge...@googlegroups.com
Hey Oliver,

Wow, it looks like i have not been keeping with h2 developments, they have added support for geometry types.


I was not aware of this. I'll have to see how this will affect geodb but at this point there has been nothing done in terms of integration. 

-Justin

nico....@gmail.com

unread,
Dec 12, 2013, 8:54:53 AM12/12/13
to ge...@googlegroups.com
Hi,

I'm the commiter that help to introduce Geometry type into H2. H2 now natively support Geometry type and memory & file based spatial index. Internally H2 use JTS for the geometry type. To create a spatial index the following syntax has been chosen by Noel Grandin "create spatial index on mytable(mygeomcolumn)"

To do bounding box intersection of geometries the operator && has been created, it use the spatial index if available.

The spatial index use the new MVSTORE storage system.

-Nicolas

Justin Deoliveira

unread,
Dec 12, 2013, 9:15:01 AM12/12/13
to ge...@googlegroups.com
Hey Nicolas,

I was very intrigued when I found this out the other day :) Very exciting, congrats on the work. I am very eager to try this out. I can't find much in terms of documentation though... for instance what spatial functions are available, is it SFS? Also info on how to create spatial index, etc..

It appears the work is still young so i understand much of this is not there... but anything you could point me at would be great. 

Thanks! And exciting to see H2 adopt spatial functionality in the core!

-Justin


--
You received this message because you are subscribed to the Google Groups "geodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geodb+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

nico....@gmail.com

unread,
Dec 12, 2013, 9:27:25 AM12/12/13
to ge...@googlegroups.com
Hi,

Thank you, I can assure you, it was a team effort; and there is more work to do.

There is no spatial function in h2. However we release an external library called h2gis that fully support sfsql; projection systems and some file drivers.It is based on the last h2 version.

-Nicolas

Justin Deoliveira

unread,
Dec 12, 2013, 9:31:40 AM12/12/13
to ge...@googlegroups.com
On Thu, Dec 12, 2013 at 7:27 AM, <nico....@gmail.com> wrote:
Hi,

Thank you, I can assure you, it was a team effort; and there is more work to do.

There is no spatial function in h2. However we release an external library called h2gis that fully support sfsql; projection systems and some file drivers.It is based on the last h2 version.

Ahh I see. Cool. I hope to try out soon and provide some feedback!

-Nicolas


Le jeudi 12 décembre 2013 15:15:01 UTC+1, jdeolive a écrit :
Hey Nicolas,

I was very intrigued when I found this out the other day :) Very exciting, congrats on the work. I am very eager to try this out. I can't find much in terms of documentation though... for instance what spatial functions are available, is it SFS? Also info on how to create spatial index, etc..

It appears the work is still young so i understand much of this is not there... but anything you could point me at would be great. 

Thanks! And exciting to see H2 adopt spatial functionality in the core!

-Justin

--
You received this message because you are subscribed to the Google Groups "geodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geodb+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages