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
Standardize Validation #228
Conversation
- Add builds for libgeos 3.4, 3.5, 3.6, 3.7, 3.8 (via ubuntu versions) - Add osx build (with latest geos installed via homebrew) - Add ruby 2.7 - Use jruby 9.2.13.0
Broaden travis ci build matrix
…int error on buffer_with_style test
…or. Removed self-intersecting is_simple? test on CAPIPolygons because this will be version dependent.
After trying again, I was able to get tests to fail locally by switching libgeos versions. The issue is that in older versions of libgeos (<3.8), only The simplicity check that the This will be a breaking change since users with older versions of libgeos will now have more strict validation requirements on projected factories. |
The reason for overriding The only issue with this could be if there's a case where a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, however it is definitely a breaking change. I guess you could add this change to the History.md file and we'll start a dev-3 branch (or the naming your prefer!)
# having issues with floating point errors on some systems | ||
# 4.3 -> 4.29999999999999, for example, and throws an error | ||
# iterating through points and using assert_in_delta instead | ||
# of assert_equal | ||
b_coords = buffered_line_string.exterior_ring.coordinates | ||
p_coords = polygon.exterior_ring.coordinates | ||
p_coords.zip(b_coords).each do |p_coord, b_coord| | ||
p_coord.zip(b_coord).each do |pt1, pt2| | ||
assert_in_delta(pt1, pt2, 1e-7) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is not satisfying, but this PR is not the place to fix floating point errors!
test/simple_mercator/polygon_test.rb
Outdated
@@ -15,6 +15,14 @@ def setup | |||
@factory = RGeo::Geographic.simple_mercator_factory | |||
end | |||
|
|||
def test_is_simple_validation_behavior | |||
# issue 218 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I always find it easier to show an url in that case:
# issue 218 | |
# See https://github.com/rgeo/rgeo/issues/218 |
Summary
PR to fix #218 where
is_simple?
returns inconsistent results across libgeos versions.Other Information
I personally tried using geos versions 3.5.2, 3.6.4, 3.7.3, and 3.8.1 across multiple Rubies and did not have a failing test case. I'm using Ubuntu Bionic so that may have something to do with it, but this is inconsistent with what is described in #218 .
I also looked at the libgeos docs and there is a note in there that suggests
GeosIsSimple
will always returntrue
for polygons and thatGeosIsValid
would be the appropriate function to check for self-intersections. This is also described here https://postgis.net/docs/using_postgis_dbmanagement.html#OGC_Validity where it says "By definition, a POLYGON is always simple."