ST_MakePoint constructs a Point geometry from supplied X and Y coordinates. Pair it with ST_SetSRID to assign the coordinates’ spatial reference metadata before using spatial distance queries. section 10.5.1
Create a point for a known location
WITH roost_hotel AS ( SELECT ST_SetSRID( ST_MakePoint(-9178356.224987695, 3242002.0503882724), 3857) AS point ) SELECT p.name, round(ST_Distance(h.point, p.way)) AS distance_meters FROM roost_hotel AS h JOIN florida.planet_osm_point AS p ON ST_DWithin(h.point, p.way, 500) WHERE p.amenity = 'restaurant' ORDER BY distance_meters LIMIT 5; The query creates a Web Mercator point, finds restaurants within 500 units, and orders the five nearest results. section 10.5.1
