[postgis-users] remove duplicate line segments

paul.malm at lfv.se paul.malm at lfv.se
Fri Jun 12 02:18:22 PDT 2020


Hi,
If someone could help me with this, I would be grateful.
I've converted a polygon layer to a line layer. Sometimes the lines segments are a duplicate of another line segment (from an adjacent polygon).
I would like to delete the duplicate lines and only store the one of all duplicate line segments. It doesn't matter which one I store.
I've tried to store the line layer as a topology and erase the edges that are the same, but I don't have enough  knowledge of topologies. To be honest not much knowledge at all.
I've tried this:
DELETE FROM topo1.edge_data WHERE edge_id NOT IN (SELECT MAX(edge_id) FROM topo1.edge_data GROUP BY geom)

But I will not find any to delete, could it be that the geometry of the line segments goes in the opposite direction of each other?

But I don't know if this approach is going to work anyway.
If someone could tell me how to delete "common" line segments I would be very happy.
Kind regards,
Paul


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


More information about the postgis-users mailing list