Fix query to make the proper transformations

This commit is contained in:
Daniel García Aubert 2019-12-11 11:02:31 +01:00
parent c877d0b964
commit ea1f43bec7

View File

@ -9,12 +9,15 @@ function filterQueryTpl ({ sql, column, srid, lng, lat, radius } = {}) {
WHERE
ST_Intersects(
${column},
ST_Transform(
ST_Buffer(
ST_Transform(
ST_SetSRID(ST_Point(${lng},${lat}), 4326),
${srid}
),
ST_SetSRID(ST_Point(${lng},${lat}), ${srid}),
4326
)::geography,
${radius}
)::geometry,
${srid}
)
)
`;