I have two tables both have point geometry with SRID 4326 (WGS84) I need to find the nearest point in 1 table to every point in another table
PostGIS KNN search is written
t1.geometry <-> t2.geometry AS distance;
as I'm using WGS84 distance is in degrees I'd like distance to be in meters
https://postgis.net/docs/ST_DistanceSphere.html takes two points and calculates the distance between them like
SELECT round(CAST(ST_DistanceSphere(t1.geometry, t2.geometry ) As numeric),2) As distance
How do I combine the two functions? This errors
round(CAST(ST_DistanceSphere(t1.geometry <-> t2.geometry ) As numeric),2) As dist
ERROR: function st_distancesphere(double precision) does not exist
PostGIS version: 3.0