-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
Different Validation Behavior (is_simple) in Geos 3.8.x #218
Comments
@jdalt Any thoughts on the scope of changes regarding |
@jdalt Another thing I've noticed is that the same polygons for which |
@ykessler I don't have a good idea of the scope of the changes to I'm collecting stuff in my own test suite, but I'd need a good amount of time to deep dive and enumerate the problems. I'm curious what it would look like to run the I think the ci test matrix should probably be expanded to cover different versions of |
FWIW I ended up creating an "unpinch" function for |
This seems to be happening on earlier versions of GEOS too. The WKT that is failing for me is: POLYGON ((-51.90477158413189 -23.38227371253858 0, -51.90478667415024 -23.38227088600153 0, -51.90451182169191 -23.38179368490476 0, -51.90471120333436 -23.38160910939104 0, -51.90503792850615 -23.38206462390997 0, -51.90477158413189 -23.38227371253858 0)) Some info about my Staging (failing) setup: OS
Ruby
Rails
PostgreSQL 12
PostgreSQL 12 Postgis 3
GEOS
PROJ4
Appreciate if anyone have suggestions on how to move on. |
To everyone that might come across this issue, downgrading ruby from 2.7.0 to 2.6.5 was enough solve this issue on my production environment. So my working environment has the following setup: Good luck everyone! |
Encoding GeoJSON with the rgeo gem results in a linear ring test failure all of a sudden and I'm using the same data as before. I've been using ruby 2.6.5 this entire time, so @ricobonfim's solution won't work for me. My similar specs are as follows... Ubuntu 18.04 (via Heroku) In my development environment, I'm using postgres 11.2. Not sure if that makes a difference. Is there a way for me to opt for |
@aleciavogel you can set a specific factory with the You mention encoding in the issue, but as long as you have an RGeo geometry instance the encoder should accept it since that does not depend on a factory. |
…int error on buffer_with_style test
This has been addressed in #228 and will eventually be released in version 3.0.0. If you'd like to use it sooner, it is in the |
EDIT: Still not working for me in EDIT 2: In
with:
fixed it for me. I don't know how this would affect edge cases, but it no longer throws an error for me when simply reading polygons from ActiveRecord. Perhaps the method This doesn't seem to have anything to do with the GEOS library in my case. I found the culprit in
|
@tgrushka this issue is unrelated to the issue you're having. This is about GEOS having different definitions of a simple ring between versions, so this only affects CAPIFactories. It's hard to tell without a specific example of your geometry, but I'm guessing this is related to #212. It's known that in small geometries, the Currently, most factories validate geometries on instantiation, which means that if the rings of the polygon intersect, RGeo::Geographic.spherical_factory(uses_lenient_assertions: true) This will disable validity checks. Here's an example of how to configure the postgis adapter to use specific factories (#223 (comment)). In v3 the default behavior might be changed so that errors are not automatically raised on instantiation, but |
…int error on buffer_with_style test
…int error on buffer_with_style test
…int error on buffer_with_style test
…int error on buffer_with_style test
…int error on buffer_with_style test
RGeo has different exception throwing behavior and returns different
is_simple
values when backed by different versions of the underlyinggeos
library.Specifically the
RGeo::Geographic.simple_mercator_factory
will throw an exception when parsing a self intersecting "hour glass" polygon in3.8
while it will parse that polygon and return#is_simple?
true
in3.7
.I think this is the root cause of this stackoverflow issue: https://stackoverflow.com/questions/58996305/getting-invalidgeometry-linearring-failed-ring-test-after-upgrading-rgeo-gem
Steps to reproduce
With
geos-config --version
3.8.1
:This is a self-intersecting "hour glass" polygon:
Expected behavior
With
geos-config --version
3.5.2
,3.6.4
, or3.7.4
(built from tarball with cmake):This Polygon will be parsed. It returns
true
for#is_simple?
.Actual behavior
RGeo::Error::InvalidGeometry (LinearRing failed ring test)
System configuration
Ruby version:
ruby 2.5.7p206 (2019-10-01 revision 67816) [x86_64-darwin18]
OS:
Darwin jdalt-mbp.local 18.7.0 Darwin Kernel Version 18.7.0: Thu Jan 23 06:52:12 PST 2020; root:xnu-4903.278.25~1/RELEASE_X86_64 x86_64
Also replicated on travis-ci with Ubuntu xenial with a
geos
3.8.1 built from source/tarball.rgeo
is version2.1.1
Speculation
I think this is a difference in how
is_simple
is calculated in the CAPI. I believe all factories that use theCAPI
to calculateis_simple
are affected. I don't think the behavior ofRGeo::Geographic.spherical_factory
is affected.Additional Thoughts
This is a breaking change, but for my own purposes I prefer the new behavior. I like it because it's more consistent with the implementation of
RGeo::Geographic.spherical_factory
which I converted my app to in order to avoid the issues outlined in #212. I tried #213 but it caused too much of a performance degradation to be viable for me.However, I can't easily upgrade the underlying library in my production environment, so I'd like to get more insight into what's happening and what other mitigation options might be available to me. Ideally I'd be able to induce the 3.8 behavior in earlier versions of the library, or I'd be alerted to some other factory that's performant and consistent across versions.
I think others need to be aware that there are serious, breaking changes that exist in
geos
3.8.x
. This will become the default version of the library in Ubuntufocal
. I imagine others who frequently hop back and forth betweenmacOS
(with the library installed and updated by Homebrew) and Linux ci and/or production environments will be similarly confused by this behavior.The text was updated successfully, but these errors were encountered: