I have two tables: crimes (points/ST_MakePoint) and ways (multilinestring). Initially what I did was reposition the points to the point closest to the track using the following:
UPDATE renzagoras.delitos as d
SET geom = (
SELECT ST_ClosestPoint(r.geom, d.geom)
FROM renzagoras.gis_osm_roads_free_1 r
WHERE ST_DWithin(d.geom, r.geom, 10)
ORDER BY r.geom <-> d.geom LIMIT 1 )
WHERE _id = :id
Now I am interested in knowing which are the ways where these points are located and for this I tried to use ST_Intersect but it did not return all the ways (only some). Has anyone already experienced this type of case?
st_snap
solution