TransWikia.com

How to remove overlapping features by percentage?

Geographic Information Systems Asked by Don P on July 23, 2021

I have geometry records of type MultiLineStringZM and I am trying to INSERT new records that overlap some of the records currently in the table. If they were type MultiPolygon I could use ST_Area() as in the following

SELECT a.id
    FROM a, b
    WHERE ST_Area(ST_Intersection(a.geom, b.geom)) > 0.5 * ST_Area(a.geom);

to identify the polygons that overlap by a majority. However ST_Area is not a compatible function for MultiLineStringZM, and the above query does not return any results.

ST_Covers(), ST_Within() & ST_Intersects() will either not return any results or return too many depending.

How can I identify & delete all records overlapped by a ‘majority’ or some specified fraction for this geometry type?

One Answer

I would try (not tested)

SELECT a.id
FROM a, b
WHERE ST_Length(ST_Intersection(a.geom, b.geom)) > 0.5 * ST_Length(a.geom);

Answered by Jesús Pinilla on July 23, 2021

Add your own answers!

Ask a Question

Get help from others!

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