Comments (5)
@biomiker have you had a chance to look at this issue? Do you think you could fix it and create a PR?
from geoswift.
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:
open class LinearRing : LineString {
public convenience init?(points: [Coordinate]) {
let seq = GEOSCoordSeq_create_r(GEOS_HANDLE, UInt32(points.count), 2)
for (i,coord) in points.enumerated() {
GEOSCoordSeq_setX_r(GEOS_HANDLE, seq, UInt32(i), coord.x)
GEOSCoordSeq_setY_r(GEOS_HANDLE, seq, UInt32(i), coord.y)
}
guard let GEOSGeom = GEOSGeom_createLinearRing_r(GEOS_HANDLE, seq) else {
return nil
}
self.init(GEOSGeom: GEOSGeom, destroyOnDeinit: true)
}
}
from geoswift.
@johncrenshaw could you create a pull request with this change and tests? Thanks!
from geoswift.
@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
from geoswift.
Fixed by #50
from geoswift.
Related Issues (20)
- Infinite loop issue with queryNode function HOT 7
- Command CompileSwiftSources failed with a nonzero exit code HOT 7
- [SPM] dyld[10829]: Library not loaded: @rpath/geos.framework/geos HOT 1
- Xcode Cloud: Unable to verify project that links GEOSwift using SPM HOT 2
- Inaccurate heatmap output. Maybe My Code is Wrong? HOT 3
- Question: Storing large GeoJSON Files for usage with GEOSwift HOT 2
- Update for Swift Concurrency
- Confused about `distance(to:)` usage or units HOT 2
- No access to LineStringSnapper HOT 6
- Expose Hausdorff Distance functions
- Support Z coordinates HOT 1
- CI is broken HOT 1
- Request: concave hull support HOT 12
- Support for fixing invalid geometries with GeometryFixer/GEOSMakeValidWithParams HOT 3
- Getting at coordinates after a Polygon is buffered HOT 3
- Searching for point within a large geoJSON file HOT 6
- Get struct out of GEOSwift.JSON HOT 4
- PreparedGeometry branch Library Not Loaded HOT 9
- Prepared Geometry Codable or Public Base Access
- Compiling with Xcode 15.0 beta 5 for "My Mac (Mac Catalyst)" fails with "ld: Undefined symbols:..." HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geoswift.