[gdal-dev] Python API

Frank Warmerdam warmerdam at pobox.com
Wed Mar 6 16:00:59 PST 2013

On Wed, Mar 6, 2013 at 11:01 AM, Jeremy Palmer <JPalmer at linz.govt.nz> wrote:

> Hi All,
> I've got a few questions about the support and future of some method calls
> within the OGR Python API.
> 1/ What is preferred way to method to access geometries from features? is
> it feature.geometry() or feature.GetGeometryRef()? "geometry()" seems funny
> as it's not well documented and is not declared using camel case (or at
> least starting with a capital letter). Is this going to be well supported
> in the future?


Hmm, I didn't know that geometry() existed.  I always call GetGeometryRef()
which is a bit ugly.   I see geometry() called exactly once in the autotest
suite so I would not be terribly certain it will continue to exist.

> 2/ Is accessing feature field values via the pythonic attribute interface
> (i.e feature['myatt'] or feature['myatt'] = 1) the preferred way? Also is
> this API going to be well supported in the future?

 I do not see why this should go away.

3/ Following on from discussion about destroy() from
> geo.org/gdal/wiki/PythonGotchas, can it be confirmed if you need to call
> destroy at 'all' on OGR objects with GDAL/OGR 1.9? Can some examples be
> given?

I now never call destroy but I do something set references to None to
control object lifetime.

No really solid answers but hopefully better than silence.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130306/14ead6e4/attachment.html>

More information about the gdal-dev mailing list