How to remove overlapping lines in postgis

I have a typical database with millions of polygons as land, and I want to break these polygons into lines, and then remove the lines that intersect with each other. These lines will be used exclusively for rendering in mapnik / and / or geoserver, since at the moment each parcel boundary is received twice.

I propose to break the polygons of the parcels into a new table ("border_lines"), and then look for and remove overlapping lines. how can i remove these overlapping lines in postgis?

+3
source share
1 answer

Use ST_Equals:
http://postgis.refractions.net/docs/ST_Equals.html

Your SQL statement will probably look something like this:

SELECT y.id, z.id 
FROM mytable y, mytable z
WHERE ST_Equals(y.the_geom,z.the_geom)

The request will be executed forever, but hopefully you only need to do this once. After starting, run the results and carefully remove duplicate identifiers.

Note that this will not eliminate borders that do not overlap exactly.

+1
source

Source: https://habr.com/ru/post/1758060/


All Articles