I have a Geo table with geometry column storing point data SRD=4326
I need to find all points within a given distance in meters of a Longitude, Latitude
Do I create a geography column from the geometry column or the Longitude, Latitude stored in the table
or
Do the conversion on the fly within the query
Could someone suggest how to perform both options and there pro & cons?
Best Answer
You can do it both ways, storing geography or storing geometry and convert on the fly. If you create a
geom
column not based onSRID 4326
, you can convert it to a geography type before the computation as follows (using the ST_DWithin function)Of course, this second approach is slower in use because of the need to cast geom to geography type.