[geos-devel] GEOS Swig Patch - New support for Ruby

strk at refractions.net strk at refractions.net
Thu Dec 22 07:53:19 EST 2005


On Thu, Dec 15, 2005 at 11:24:11AM -0700, Charlie Savage wrote:
...
> I have just provided a patch to strk that updates the GEOS swig 
> bindings.  I have not included it below, because it is quite large due 
> to the inclusion of SWIG generated wrapper files.

Committed, except from geos_wrap.cxx, which I'd like to be
produced at release time but not included in CVS.
We can discuss this...


> What needs work:
> 
> * As always, the key issues with SWIG bindings is memory management.  
> Right now the bindings assume that any time one of the following 3 types 
> is passed in as a parameter to a method, then the method's class takes 
> over ownernship of the parameter:
> 
> geos::CoordinateSequence *
> geos::LinearRing *
> std::vector<geos::Geometry * > *
> 
> I'd guess this is not true.  If someone who is more familiar with the 
> GEOS C++ api could let me know, I can fix this
> 
> Similarly, a brief look through the GEOS api shows some methods return 
> new objects.  SWIG must be told about these methods.  So once again, 
> does someone have a list of these methods?

There are no lists, just some tips in the API docs.

> * The example.py and example.rb files crash when trying any of the 
> combination methods (union, intersection, etc.).  My guess it has to do 
> with the memory management item listed above.  
> 
> * The bindings compile against the C++ api, not the C api.  This could 
> be changed, but would require a significant amount of work.

Importance of this depends on how much of the exposed API is used,
and how much time you intend to put in maintaining the code.
The API subset present in the C-API is about what is likely to
be stable in the C++ lib as well.

--strk;



More information about the geos-devel mailing list