I am using hibernate spatial and postgis and i want to find the points that fall within a certain radius. Using this SQL:
SELECT name FROM institution WHERE ST_DWithin(geom,ST_GeographyFromText('SRID=4326;POINT(36.9881 0)'), 5000)
I get the points within 5KM.
Using Hibernate Spatial i am doing
Criteria criteria = getCurrentSession().createCriteria(Institution.class, "i"); Geometry geometry = .... criteria.add(SpatialRestrictions.distanceWithin("i.geom", geometry, distance));
But it does not return distance in Metres. What do I need to do?