Distance based search

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

Distance based search

rico.hauke-2

Hi list,

I want to do a distance search via postgis sql function distance_sphere() or distance_spheroid() in hql but couldn't find any examples how to do that.
I also looked into the source code test suite suggested in another thread but also couldn't find anything.

So could anyone help me how to perform a distance query in a spherical reference system?

Thanks,
Rico

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Distance based search

Karel Maesen
Administrator
Hi Rico,

The Postgis distance_sphere() and distance_spheroid() are not in the  
Simple Feature Specifications (SFS), that is why they are not  
registered with HQL.  Adding these functions would also be contrary  
to the intent, which is to have an SFS-compliant Hibernate extension  
that works the same across all supported databases.

So what do you do? For now, I think, you should use a Native SQL  
query. This bypasses Hibernate and uses the JDBC directly. Check the  
Hibernate documentation relating to the Session.createSQLQuery() method.

Soon, Hibernate Spatial will have a facility that exposes the native  
spatial support of the database through a database-specific  
SpatialProjection/SpatialRelateExpression factory class.  See this  
post for relevant discussion: http://www.hibernatespatial.org/ 
pipermail/hibernatespatial-dev/2007-November/000021.html

Btw, may I invite you to subscribe to the mailing list? Your post was  
initially blocked because you're not a list member.

Regards,

Karel Maesen


On 09 Nov 2007, at 10:09, [hidden email] wrote:

>
> Hi list,
>
> I want to do a distance search via postgis sql function  
> distance_sphere() or distance_spheroid() in hql but couldn't find  
> any examples how to do that.
> I also looked into the source code test suite suggested in another  
> thread but also couldn't find anything.
>
> So could anyone help me how to perform a distance query in a  
> spherical reference system?
>
> Thanks,
> Rico
> _______________________________________________
> 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