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

Don't validate results from GEOS #526

Merged
merged 1 commit into from
Sep 26, 2023
Merged

Conversation

peterstace
Copy link
Owner

@peterstace peterstace commented Sep 15, 2023

Description

Recent versions of GEOS use OverlayNG (NG stands for New Generation) for set operations between geometries (Intersection, Union, etc.). With the introduction of OverlayNG, invalid geometries are no longer frequently produced by GEOS. They are either non-existent, or very rare.

Before this change, the simplefeatures GEOS wrapper validates results from GEOS.

This feels like a misalignment:

  • Validation isn't free, so validating GEOS results seems like the wrong default.

  • The GEOS wrapper is doing more than strictly wrapping the GEOS library (it is also validating the result). This blurs the lines between what simplefeatures is doing and what GEOS is doing.

This change removes that validation. Users can of course still validate manually by calling the Validate method on the result.

Check List

Have you:

  • Added unit tests? No, because it's removal of an existing feature.

  • Add cmprefimpl tests? (if appropriate?) N/A.

  • Updated release notes? (if appropriate?) Not yet. There will be a large amount of changes for this release, so I'll add release notes at the end.

Related Issue

Benchmark Results

  • Please paste benchmark results here. The benchmarks can be run using the
    run_benchmarks.sh script.

Not much to see here. All benchmark results are the same, except for benchmarks for GEOS operations which are now faster (due to the change in validation behaviour).

bench_results.txt

Recent versions of GEOS use OverlayNG (NG stands for New Generation) for
set operations between geometries (Intersection, Union, etc.). With the
introduction of OverlayNG, invalid geometries are no longer frequently
produced by GEOS. They are either non-existent, or very rare.

Before this change, the `simplefeatures` GEOS wrapper validates results
from GEOS.

This feels like a misalignment:

- Validation isn't free, so validating GEOS results seems like the wrong
  default.

- The GEOS wrapper is doing more than strictly wrapping the GEOS library
  (it is also validating the result). This blurs the lines between what
  simplefeatures is doing and what GEOS is doing.

This change removes that validation. Users can of course still validate
manually by calling the `Validate` method on the result.
@peterstace peterstace self-assigned this Sep 15, 2023
@@ -33,31 +33,14 @@ func regularPolygon(center geom.XY, radius float64, sides int) geom.Polygon {
return poly
}

func BenchmarkIntersectionWithoutValidation(b *testing.B) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A benchmark that distinguishes between validating and non-validating operations no longer makes sense, so I've removed this one.

@peterstace
Copy link
Owner Author

Thanks for reviewing @albertteoh , I really appreciate it 😁

@peterstace peterstace merged commit 67ef7a0 into master Sep 26, 2023
1 check passed
@peterstace peterstace deleted the no_validation_in_geos_wrapper branch September 26, 2023 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants