Better condition

This commit is contained in:
Daniel García Aubert 2019-12-16 12:54:17 +01:00
parent da07d550d2
commit 6e455a1205

View File

@ -8,7 +8,7 @@ function filterQueryTpl ({ sql, column, srid, lng, lat, radiusInMeters } = {}) {
FROM (${sql}) _cdb_circle_filter
WHERE
ST_DWithin(
${srid === 3857 ? `ST_Transform(${column}, 4326)::geography` : `${column}::geography`},
${srid === 4326 ? `${column}::geography` : `ST_Transform(${column}, 4326)::geography`},
ST_SetSRID(ST_Point(${lng}, ${lat}), 4326)::geography,
${radiusInMeters}
)