How to update geometry by snap to polygons in same layer

Geographic Information Systems Asked by Torsten on May 9, 2021

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,, 
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?

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP