-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Change for a more strict geojson handling. #47
base: master
Are you sure you want to change the base?
Conversation
72f903f
to
13739e5
Compare
- Do not handle m coordinate. - Raise for unknown geojson `type`. - Allow less strict polygons (not simple). Which is ok per spec. - Add various tests.
13739e5
to
fe72a9a
Compare
Before (no right-hand rule) ``` Warming up -------------------------------------- big geometry 32.000 i/100ms small geometry 10.379k i/100ms Calculating ------------------------------------- big geometry 343.166 (± 2.6%) i/s - 1.728k in 5.039023s small geometry 106.304k (± 2.1%) i/s - 539.708k in 5.079398s ``` After (right-hand rule) ``` Warming up -------------------------------------- big geometry 1.000 i/100ms small geometry 2.780k i/100ms Calculating ------------------------------------- big geometry 9.085 (± 0.0%) i/s - 46.000 in 5.069703s small geometry 28.541k (± 2.9%) i/s - 144.560k in 5.069153s ```
def test_encode_geometry_geometrycollection | ||
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.
Should there be a test for this?
Looks good! Once that GeometryCollection test is resolved, it should be good to merge. We'll likely have to do a major version release because of the deprecation of |
That is definitely a major. Deprecation of, significant performance changes. I'll
And then give it back to you for a final review :) About the performance drawback in b9bc47a, are you ok with that ? |
Since it's just on the encoder and the 2016 GeoJSON spec indicates that the winding must follow the right-hand rule I think it should be included. We can still parse GeoJSON that doesn't follow the right-hand rule so it shouldn't limit accesability. If we're seeing that it's too much of a performance hit for it to be usable for a good amount of people we could make an option to enforce it later, but I think following the spec is important. |
Actually, after looking at this comment #39 (comment), we should probably add the option in this release if it's not too much work. I think making it |
Thanks for your inputs @keithdoggett, Since I find it bothering to have a more complex API, I tried to find a way to improve performances. Hence I looked at geos, and the Without direction check:
With a ruby direction check:
With a c direction check:
We can see that performance is nearly the same between c implementation and no check. Hence we could not add the What do you think ? If you like this idea, I can push the c analysis implementation is rgeo as well, which is quite light anyway :) (this would still be a minor, since i'll add a method in the |
Yes, I agree that keeping the API simple is best and that seems like a good solution! |
@keithdoggett once the rgeo/rgeo#229 is merged and published, I'll change the method name here and we'll be able to publish the new version :) |
@BuonOmo what's the status of this PR? Do we need to update it to use the new |
@keithdoggett thanks for pointing it out indeed. I think we can:
Does it look OK to you ? I'm not sure I'll have time to do it this week though |
Done:
type
.uses_lenient_assertions
to allow complex polygons.=> We could also fix the issue in RGeo altogether (https://github.com/rgeo/rgeo/compare/fix/correct-area-when-invalid-polygon). But this comes with a performance cost that we should avoid, at least until another major. Hence, and since anyway it seems like people expect those polygons to pass (which is also per spec), we let those pass in the mean time.
Question: