I try to snap automatically polygons to other polygons in the same table. The following doesn't work.

update table w
set geometry = ST_Snap(geometry, w.geometry, 30)
where txt_grund='osm_primary';

By this nothing happens. I have one table with polys about different themes. They have to be adjacent together and I want that the vertices snap each other. In the moment their is a difference arround 30 m between the polys.

I tried also to snap the vertices from polys from a different table and get many polys but not snapping:

select  c.gid, c.bio, 
st_snap(c.geom, st_closestpoint(w.geometry, c.geom), st_distance(c.geom, st_closestpoint(w.geometry, c.geom))*1.0 ) as geom
from (select geometry from wtable) as w, 
(select gid, bio, geom from ctable where pk_ident = '3941SW0896') as c

How to use postgis to snap the vertices?

  • 4
    What does not work? – Ian Turton Jan 4 at 18:05
  • 1
    Shouldnt it be ST_Snap(w.geometry, geometry, 30) when you are trying to update table w? – BERA Jan 4 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.