I'm trying to find the closest point in a line from an insertion point closest to it. To do it, in the middle of the function I use
select id from rede_viaria.t_rviaria_via vias
where
st_intersects(
st_closestpoint(
vias.the_geom,
(st_transform(
ST_GeomFromEWKT(
'SRID=3857;POINT(-922235.81565421 5053077.824914)'
), 3763)
)
),
vias.the_geom
);
The problem is that I'm receiving 1200 rows instead 1 based on the intersection. Could anyone please help? What I'm doing wrong?