Query all places within a given distance around a reference point

2 messages Options
Embed this post
Permalink
Sebastien ARBOGAST

Query all places within a given distance around a reference point

Reply Threaded More More options
Print post
Permalink
It's the first time I play with a GIS database and Hibernate Spatial,
and I need to perform some simple query. I could probably figure it
out myself but the amount of documentation, specifications and
standards to read is really frightening. So maybe someone can help me
here.

In my PostGIS hibernate-managed database, I have a Place entity whose
location property is a com.vividsolutions.jts.geom.Point.
Then in my business method I build a reference location ref as another Point.
All my points have a latitude in x, longitude in y, and altitude in z.
Now I would like to write an Hibernate query to find all the Place's
whose location loc is such that the geodetic distance between ref and
loc is less than a given distance d.

How would I write such a query?

--
Sébastien Arbogast

http://www.sebastien-arbogast.com
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Karel Maesen

Re: Query all places within a given distance around a reference point

Reply Threaded More More options
Print post
Permalink
Hi Sébastien,

At the moment, Hibernate Spatial with PostGIS is strictly 2D. It  
currently ignores the z-coordinate. Neither does it support geodetic  
operations.  3D/Geodetic features haven't been supported because the  
main specification that we support is the OGC's Simple Feature  
Specification which is 2D. Storage of Z- and M-coordinates will come  
soon, however. We already did that for the Oracle Spatial support.

You will therefore need a direct SQL query that uses the newer  
postgis functions such as "distance_spheroid" (although I'm not sure  
whether that takes elevation into account).


Regards,

Karel Maesen




On 19 Dec 2007, at 09:46, Sebastien ARBOGAST wrote:

> It's the first time I play with a GIS database and Hibernate Spatial,
> and I need to perform some simple query. I could probably figure it
> out myself but the amount of documentation, specifications and
> standards to read is really frightening. So maybe someone can help me
> here.
>
> In my PostGIS hibernate-managed database, I have a Place entity whose
> location property is a com.vividsolutions.jts.geom.Point.
> Then in my business method I build a reference location ref as  
> another Point.
> All my points have a latitude in x, longitude in y, and altitude in z.
> Now I would like to write an Hibernate query to find all the Place's
> whose location loc is such that the geodetic distance between ref and
> loc is less than a given distance d.
>
> How would I write such a query?
>
> --
> Sébastien Arbogast
>
> http://www.sebastien-arbogast.com
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users