-- @param {Float} $1:lat -- @param {Float} $2:lng -- @param {Float} $3:radiusKm SELECT d.id, d.name, d.operator, d.capacity_mw, ST_AsGeoJSON(d.location)::TEXT as location_geojson, ST_Distance(d.location, ST_MakePoint($2, $1)::geography) / 1000 as distance_km FROM datacenters d WHERE ST_DWithin(d.location, ST_MakePoint($2, $1)::geography, $3 * 1000) ORDER BY distance_km