assuming I use the following query to match the locations to a poi within 10km distance:
SELECT
poi.poi_id,
h.loc_id,
(ST_Distance(poi.geom,h.geom)*111.111) as distanceinkm
FROM iut_poi_transl AS poi, hrs_loc as h
WHERE poi.poigr_id != 30 AND ST_DWithin(poi.geom,h.geom,0.09)
Data is SRID 4326.
Does it use the geometry or the geography type?
If uses geometry how do I have to change the query to get use geography type?
Best Answer
As per documentation of function it can use both: http://postgis.net/docs/ST_DWithin.html
boolean ST_DWithin(geometry g1, geometry g2, double precision distance_of_srid);
boolean ST_DWithin(geography gg1, geography gg2, double precision distance_meters);
boolean ST_DWithin(geography gg1, geography gg2, double precision distance_meters, boolean use_spheroid);
Watch out for this:
But for 10km buffer radius it shouldn't be a big error.