[postgis-users] removing objects and at the same time updating others

paul.malm at lfv.se paul.malm at lfv.se
Mon Jun 22 23:07:14 PDT 2020


Hi list,
I have a problem with adjacent polygons when converting them to lines,
as I would like to only have one line in the boundaries between the former polygons. Now it could be up to 5.
I've been thinking of:

1.       Creating a thin buffer around the line strings with the featureId from the line strings as a new layer.

2.       Then I should break the line strings to line segments into a new layer with where the line segments gets the featureId from the line string.

3.       Create a column (edited) in the new line-segment layer with a default value of 0

4.       Then delete from the line segments layer all segments that are within the buffer, but not the line segments that have the same featureId as the current buffer and edited value must be 0 to be deleted.

5.       The line segments that are not deleted in the current buffer shall be updated (edited = 1).

6.       Do step 4 and 5 until the all objects in the buffered layer is executed.
I've come this far:
DELETE FROM "LineSegments" USING buffered as h WHERE
ST_Contains(h.the_geom, " LineSegments".the_geom) AND
"LineSegments".edited = 0 AND
NOT h.fid=" LineSegments".fid;

But how can I set the edited vale = 1 on the objects (line segments) that are not deleted (in the current buffer) at the same time so it won't be deleted in the next run with an adjacent buffer?
Kind regards,
Paul


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200623/2a7f305b/attachment.html>


More information about the postgis-users mailing list