I have a requirement where I need to store lat/long coordinates for locations all around the world. I then need to query for those locations that are within a specified distance (in meters) from another location. These distances are usually within the 500-1000 meter range so I don't need crazy precision.
Following various examples I've found, I've been using SRID 4326 with my geometry column in a PostGIS database. The column simply holds lat/long coordinates.
The ST_DWithin method takes a distance in meters for geography types, but I don't know what the unit is for 4326. It doesn't seem to be meters with some queries that I tried. I'm assuming it's degrees.
I've read that for performing Spatial queries on small areas, it's best to use geometries since operations are quicker at the price of precision. How can I use these methods to provide meters for either ST_DWithin
or ST_Distance
?