Comments (7)
Thanks for making the test!
I think I know the issue. Will try to push something later today.
from geos.
Ack! don't leave me hangin'!!!!
I've been doing some debugging of my own but don't have a solid idea yet - can you give a newbie a 2min version of your idea?
from geos.
Sure.
The issue (I think!) has to do with the transfer of ownership of individual Geometry objects that belong to a MultiGeometry object.
If you look in Raw.CoordSeq, you'll notice a CoordinateSequence class, that has instances for both CoordSeq and CoordSeqConst.
The idea is that: sometimes you might want a coordinate sequence that lives completely separate from whatever geometry once owned it -- and sometimes you might want to just peek at the value, but let the parent geometry continue to own it.
The same thing needs to be done for Geometry.
What's happening in some cases is that the functions that convert between Haskell types and C types are unclear about whether the sub-geometries they want are ones that maintain parent ownership and ones that do not maintain parent ownership. So in a couple places we're adding a finalizer to an object whose parent (which retains ownership) already has a finalizer attached. The first one deallocates the child object through the parent, and the one attached to the child results in a "pointer being freed was not allocated" error.
The solution that I've started on is creating a Geometry class, which has instances for Geom (a type with a finalizer) and GeomConst (a type without a finalizer). Most functions will use the instance method for accessing these, but certain functions that expect the object to maintain parent ownership can specify that in their type.
Does that make sense?
from geos.
Ah yes it does! And it's not something I would have been able to get to the bottom of easily.
Just to be clear, in general I should be able to (for Polygons say) use the returned objects without being in the Geos monad right? For example:
I also emailed you separately to this - do you happen to have any good examples of using the library (esp to talk to PostGIS). I'm thinking that I might be able to help out with drafting some examples into the README, but I'm still a bit unsure whether I'm using the library right.
from geos.
The reason I ask is that even when I use PostGIS to break the multipolygon up into simple polygons
SELECT encode((ST_DUMP(ST_Simplify(wkb_geometry::geometry, 0.01))).geom::geometry(Polygon,4326), 'hex')
FROM my_table
I get a core dump on that show line ?
from geos.
Have you seen this issue after recent fixes?
from geos.
No i'm pretty sure this was closed off in an earlier PR.
from geos.
Related Issues (12)
- ReadHex format HOT 3
- cabal install failure HOT 2
- Support for Semigroup-Monoid proposal HOT 1
- Data.Geometry.Geos.Geometry doesn't export Coordinate
- Consider adding PersistentField(Sql) instances and Esqueleto querying HOT 3
- Make Ewkb support clear HOT 1
- Geography support HOT 6
- Consider adding Generic instances throughout HOT 1
- Broken referential transparency? HOT 5
- Null pointer when trying to pull out CoordSeq of a Geometry Polygon HOT 6
- Point to coordinate function
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 geos.