I have point layer in PostGIS database. Help please with query which add for each points in layer distance in attribute table between this point and another nearest point. Thanks!
Calculate distances between series of points in postgis there is similar question, but there is in answer:
UPDATE my_table SET dist=ST_Distance(my_table.geom, b.geom) FROM (SELECT geom FROM my_table WHERE **gid = 1**) b;
distance added for points - from gid = 1 point to another points. For me each point object in attribute table should have distance from point to another nearest point.
For example, I need add distance between point and another nearest point in attribute table for point: for point 1 - distance between 1 and 2; for point 2 - distance between 2 and 3; for point 3 - distance between 3 and 2; for point 4 - distance between 4 and 3; for point 5 - distance between 5 and 4; for point 6 - distance between 6 and 3.