I'm trying to snap a line theme to a point theme using PostGIS with a filter so they only snap to records with the same reference number. The query I'm using is as follows (this is a sample of the data and without the query, just trying to get the snapping working!)
CREATE TABLE public.snappedfeatures3mV13_TABLE AS SELECT st_snap(featuresshape_cut.geom, "nodes_cut ".geom, 2::double precision) AS geom, featuresshape_cut.id , featuresshape_cut.site_code FROM featuresshape_cut JOIN "nodes_cut " ON featuresshape_cut.site_code::text = "nodes_cut ".site_code::text
No errors received, seems to generate the output file fine, however the output is multiple features linking a snapped point and the two closest points, image below. Green dots are the features snapped too, the black line the original and red is the output with arrows to indicate ends of line segments. Its almost like its calculating the snaps it needs to do then stopping?
- Converted the original features to be snapped to from lines to points - no effect
- Cut the dataset down to a minimum
- Checked all inputs have valid geometry
- Generated new primary keys for all inputs
- played with snapping tolerance to ensure snapping is working as expected
- Checked all CRS are the same
No errors in PostGIS. I'm obviously missing something, what is it?
Demonstration of a single feature from the new file, there are 3 nodes in each record, the "middle" has snapped to the line as expected and the start and end are on nodes in the original line.