[postgis-users] Is there a better way for Finding Gaps/Sliver Holes?

145 views
Skip to first unread message

Shaozhong SHI

unread,
May 2, 2022, 6:22:27 AM5/2/22
to PostGIS Users Discussion
This solution does not appear to be well explained.


Has anyone tested it?

Is there a better way for Finding Gaps/Sliver Holes?

Regards,

David

Lars Aksel Opsahl

unread,
May 2, 2022, 8:39:26 AM5/2/22
to PostGIS Users Discussion
>From: postgis-users <postgis-us...@lists.osgeo.org> on behalf of Shaozhong SHI <shisha...@gmail.com>
>Sent: Monday, May 2, 2022 12:22 PM
>To: PostGIS Users Discussion <postgi...@lists.osgeo.org>
>Subject: [postgis-users] Is there a better way for Finding Gaps/Sliver Holes?
Hi

we have code that checks for overlaps and gaps on simple feature polygons and creates a spatial tables with the results. We have used this code on tables  with millions  of rows.

And yes we see gaps/overlap as polygons, lines and points .

Lars

Shaozhong SHI

unread,
May 2, 2022, 11:18:12 AM5/2/22
to PostGIS Users Discussion
That certainly looks very interesting.  I will look into it.

What are the key concept and solutions?

Regards,

David

On Monday, 2 May 2022, Lars Aksel Opsahl <Lars....@nibio.no> wrote:

Shaozhong SHI

unread,
May 2, 2022, 1:51:41 PM5/2/22
to PostGIS Users Discussion
_______________________________________________
postgis-users mailing list
postgi...@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users


Hi, Lars,

This is a mixture of codes for parallel processing and finding overlaps and gaps.

At the moment, what I am looking for is the steps and codes just for finding overlaps and gaps, namely the computational logic and codes.

It is very hard to find these in all these codes.

Regards,

David 

Martin Davis

unread,
May 2, 2022, 2:03:02 PM5/2/22
to PostGIS Users Discussion
That blog post does provide useful queries for finding polygon overlaps and gaps.  

Overlaps are found via testing if polygon interiors intersect, using the DE-9IM relate mask 2********.

Gaps are found by identifying holes in the union of the set of polygons.  One issue with this is that computing the union of large datasets can be slow.  Lars' solution provides some ideas for dealing with this.



Shaozhong SHI

unread,
May 2, 2022, 2:34:09 PM5/2/22
to PostGIS Users Discussion
On Mon, 2 May 2022 at 19:05, Martin Davis <mtnc...@gmail.com> wrote:
That blog post does provide useful queries for finding polygon overlaps and gaps.  

Overlaps are found via testing if polygon interiors intersect, using the DE-9IM relate mask 2********.

Gaps are found by identifying holes in the union of the set of polygons.  One issue with this is that computing the union of large datasets can be slow.  Lars' solution provides some ideas for dealing with this.


I think that matters are rather more complex than this.

For instance, I found 2 lines meet with each other at both ends.  In this case, 2 intersections are both a point.  One will find two lines form an enclosed area.

When 2 lines intersect or meet/touch more than 2 times, intersection will return more than 2 points.   For instance, when two lines meet at 3 points, one would get 2 gap polygons.

Given 2 zigzagging lines, how to write a function to return overlaps and gaps is an interesting matter.

Regards,

David
 

Martin Davis

unread,
May 2, 2022, 2:54:49 PM5/2/22
to PostGIS Users Discussion
Yes, that technique only applies to polygonal coverages.

Your use case is not clear to me.  An example dataset might make that more clear.

Shaozhong SHI

unread,
May 2, 2022, 4:49:15 PM5/2/22
to PostGIS Users Discussion
Sorry, I have not got any example dataset.

If some one can create a schematic/mock-up data set, we can test our way forward.

I am looking into the fundamentals of data testing and quality assurance techniques by using PostGIS.

Regards,

David

Martin Davis

unread,
May 3, 2022, 12:03:09 PM5/3/22
to PostGIS Users Discussion
You are the only one who understands your use case, so you have to provide the example data.
Reply all
Reply to author
Forward
0 new messages