-
Notifications
You must be signed in to change notification settings - Fork 170
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
Problems arise when using LinearRing convenience initializer #37
Comments
@biomiker have you had a chance to look at this issue? Do you think you could fix it and create a PR? |
I just ran into this and came here looking to see if it was a known issue. The problem is that LinearRing creates the underlying geometry using GEOSGeom_createLineString_r(), but GEOSGeom_createPolygon_r() requires that the shell and holes be created using GEOSGeom_createLinearRing_r(). I can confirm that adding a convenience initializer to LinearRing and and using GEOSGeom_createLinearRing_r() in that initializer resolves the problem. This is what LinearRing looks like with the fix:
|
@johncrenshaw could you create a pull request with this change and tests? Thanks! |
@johncrenshaw Thank you for creating the pull request. I have made a minor change and created a PR on your repo. Please have a look at it, and if you're happy with it, update your PR and we can merge it. Let me know your thoughts |
Fixed by #50 |
First off, thank you, this library is amazing! Here's the issue I found.
The convenience initializer
LinearRing(points: [Coordinate])
gives you back a LinearRing object but not quite a valid one. This is evident in its WKT which describes itself as a LINESTRING. It also causes errors in methods that expect a valid LinearRing, such as the convenience initializerPolygon(shell: LinearRing, holes: Array<LinearRing>?)
.Some sample code and output follows to help illustrate the problem. If I take the LinearRing's WKT, replace LINESTRING with LINEARRING, and pass it to Geometry.create(), I end up with a valid LinearRing.
Output:
The text was updated successfully, but these errors were encountered: