how to snap points to lines in QGIS/PostGIS?

المشرف العام

Administrator
طاقم الإدارة
I'm attempting to snap approximately 900 points to a line table.

I've tried recreating what I have found from a couple of PostGIS answers but not having much luck. To test, I've created two simplified tables; one for points (ptest) and one for the lines (ltest). The test tables only consist of an ID column.

CREATE TABLE line_attribute_point AS SELECT distinct on (ltest.id) ltest.*,ST_ClosestPoint(ltest.geom, ptest.geom) as snapped_point FROMltest,ptestORDER BY ST_Distance(ltest.geom, ptest.geom);

The main error seems to be the ORDER BY.

Any ideas?

Thanks



أكثر...
 
أعلى