UDST / spandex

Spatial Analysis and Data Extraction
http://nbviewer.ipython.org/github/synthicity/user_meeting_2014/blob/gh-pages/spandex/spandex_demo.ipynb
BSD 3-Clause "New" or "Revised" License
22 stars 7 forks source link

Diagnostic function for detecting overlapping geometry (not duplicate stacked) #24

Closed janowicz closed 10 years ago

daradib commented 10 years ago

Example SQL command:

SELECT a.parcel_id AS parcel_id_a,
       b.parcel_id AS parcel_id_b,
       (ST_CollectionExtract(ST_Intersection(a.geom, b.geom), 3)) AS geom
FROM   sample.heather_farms AS a,
       sample.heather_farms AS b
WHERE  a.gid < b.gid
       AND ST_Overlaps(a.geom, b.geom);

This will return pairwise overlaps between parcels by selecting the two parcel IDs and their overlapping geometry, which can be inspected in QGIS.

Unfortunately, there are many small, sliver overlaps in typical data which need to be dealt with. I tried preprocessing with ST_SnapToGrid (to deliberately lose negligible precision), but that sometimes invalidates the geometries with self intersections (can be fixed with ST_MakeValid) and causes "jumps" in diagonal boundaries.

daradib commented 10 years ago

Done in #42. Doesn't ignore small sliver overlaps, but I'm leaving out that functionality for now and closing.