Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isisminer does not properly handle the presence of bad (e.g. self-intersecting) polygons. #5612

Open
kledmundson opened this issue Sep 12, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@kledmundson
Copy link
Contributor

kledmundson commented Sep 12, 2024

ISIS version(s) affected: x.y.z
dev

Description

The footprintinit application will sometimes create invalid, self-intersecting polygons. The isisminer application detects bad polygons, reports them, and terminates instead of attempting to repair them.

Solution

In many cases, self-intersecting polygons can be repaired by creating a buffer of size 0 around the polygon. This is analogous to stretching a rubber band around all points in the polygon (see slide below). The buffer(0) approach will likely fix many (though possibly not all) self-intersecting polygons. While the fix should be incorporated into footprintinit, it should also be implemented in isisminer.

Additional context

The slide below shows a polygon with a highlighted self-intersection in blue. The self-intersection was repaired (shown in orange) by applying a buffer of 0.1 around all polygon vertices. Note that typically a buffer of size 0 is applied. Here, a buffer of 0.1 was used for illustration purposes only.

selfIntersectingPolygons
@kledmundson kledmundson added the bug Something isn't working label Sep 12, 2024
@acpaquette
Copy link
Collaborator

@kledmundson Couple insights/questions. Is there a planned fix from the yourself or Kris coming in for this? Second, is seems related to #5553

@kledmundson
Copy link
Contributor Author

kledmundson commented Sep 12, 2024 via email

@KrisBecker
Copy link
Contributor

This fix is not directly related to #5553 because GisGeometry uses the GEOS C-API. Code in PolygonTools uses the C++ API so they are separate. We added a buffer() method to GisGeometry.

They are likely related as some GIsFootprints created by ISIS have self-intersections. These leak through into isisminer processing and aborts the run. The fix that @kledmundson is providing runs a buffer( 0 ) on the whole polygon in an attempt to fix them. Most all occurrences are fixed using this technique.

@kledmundson kledmundson changed the title Bug in GisGeometry/Strategy classes utilized by isisminer application Isisminer does not properly handle the presence of bad (e.g. self-intersecting) polygons. Sep 13, 2024
kledmundson pushed a commit to UA-LPL/ISIS3 that referenced this issue Sep 23, 2024
* GisGeometry was throwing an exception when isValid() was called and the geometry was indeed invalid
* GisGeometry - added buffer() method
* Strategy was updated to better manage geometries
* Strategy - Added RepairInvalidGeometry and InvalidGeometryAction to allow better user control over invalid geometries
* Strategy - Apply buffer(0) algorithm when an invalid geometry is detected
* Strategy - Added more debug output
kledmundson pushed a commit to UA-LPL/ISIS3 that referenced this issue Sep 23, 2024
…5612.

* GisGeometry was throwing an exception when isValid() was called and the geometry was indeed invalid
* GisGeometry - added buffer() method
* Strategy was updated to better manage geometries
* Strategy - Added RepairInvalidGeometry and InvalidGeometryAction to allow better user control over invalid geometries
* Strategy - Apply buffer(0) algorithm when an invalid geometry is detected
* Strategy - Added more debug output
* isisminer - improved handling of invalid/bad geometries
* isisminer - Documented new parameters RepairInvalidGeometry and InvalidGeometryAction and updated Calculator strategy documentation
kledmundson added a commit to UA-LPL/ISIS3 that referenced this issue Sep 23, 2024
…n geometries were not treated properly. Added pertinent unit tests to GisGeometry and Strategy classes. Fixed incorrect links and minor typos in isisminer documentation. Addresses DOI-USGS#5612.
kledmundson pushed a commit to UA-LPL/ISIS3 that referenced this issue Oct 8, 2024
* GisGeometry was throwing an exception when isValid() was called and the geometry was indeed invalid
* GisGeometry - added buffer() method
* Strategy was updated to better manage geometries
* Strategy - Added RepairInvalidGeometry and InvalidGeometryAction to allow better user control over invalid geometries
* Strategy - Apply buffer(0) algorithm when an invalid geometry is detected
* Strategy - Added more debug output
kledmundson pushed a commit to UA-LPL/ISIS3 that referenced this issue Oct 8, 2024
…5612.

* GisGeometry was throwing an exception when isValid() was called and the geometry was indeed invalid
* GisGeometry - added buffer() method
* Strategy was updated to better manage geometries
* Strategy - Added RepairInvalidGeometry and InvalidGeometryAction to allow better user control over invalid geometries
* Strategy - Apply buffer(0) algorithm when an invalid geometry is detected
* Strategy - Added more debug output
* isisminer - improved handling of invalid/bad geometries
* isisminer - Documented new parameters RepairInvalidGeometry and InvalidGeometryAction and updated Calculator strategy documentation
kledmundson added a commit to UA-LPL/ISIS3 that referenced this issue Oct 8, 2024
…n geometries were not treated properly. Added pertinent unit tests to GisGeometry and Strategy classes. Fixed incorrect links and minor typos in isisminer documentation. Addresses DOI-USGS#5612.
kledmundson added a commit to UA-LPL/ISIS3 that referenced this issue Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants