[geos-devel] Re: Prepared geometry API

Paul Ramsey pramsey at opengeo.org
Wed Apr 8 10:47:00 EDT 2009


I think, having examined this and talked w/ martin about intent, the
documentation is wrong. Argument ownership is *not* taken, the
prepared geometry does not fully subsume the original geometry. At
least wrt JTS interpretations.

There are a number of implementations in PostGIS and probable some
python projects too that now manage the prep and the original geom
separately, precisely to avoid the leak mentioned in your test case.

P.

On Wed, Apr 8, 2009 at 5:08 AM, strk <strk at keybit.net> wrote:
> While working on a testcase for prepared geometries in GEOS
> I've found that the documentation for the "GEOSPrepare" function
> doesn't match with actual behaviour:
>
>  /*
>  * Argument ownership is taken by prepared geometry
>  */
>  extern const GEOSPreparedGeometry GEOS_DLL *GEOSPrepare(const GEOSGeometry* g);
>
> Testcase is along these lines:
>
>        GEOSGeometry* g = GEOSGeomFromWKT("POLYGON EMPTY");
>        const GEOSPreparedGeometry* pg = GEOSPrepare(g);
>        GEOSPreparedGeom_destroy(pg);
>
>        // 'g' leaks w/out the call below
>        //GEOSGeom_destroy(g);
>
> So, is it documentation wrong or implementation ?
>
> --strk;
>
>  Free GIS & Flash consultant/developer      ()  ASCII Ribbon Campaign
>  http://foo.keybit.net/~strk/services.html  /\  Keep it simple!
>


More information about the geos-devel mailing list