[Gdal-dev] python, multipolygon creation

Frank Warmerdam warmerdam at pobox.com
Thu Feb 9 08:08:46 EST 2006


On 2/9/06, Didrik Pinte <dpinte at itae.be> wrote:
> I got an error message. It's 3. I looked in the ogr.py file but there is
> no definition of the return messages.
>
> May I suggest one of the following :
>
> [1] add a definition for OGRERR_NONE and
> OGRERR_UNSUPPORTED_GEOMETRY_TYPE in ogr.py

Didrik,

The problem I have with python declarations for all error
codes is that it could be a big hassle to maintain.  Of course
in practice I hate error code catalogs and so end up reusing the
same very small list of error codes (mostly OGRERR_NONE and
OGRERR_FAILURE), so perhaps my point is silly.

For the most part, it is sufficient to check for a nonzero return
to know you have an error.

> [2] as suggested by you, issue an error message or throw an exception
> (that should be more pythonic).

I think Kevin has it setup in the new interfaces so that you can
force all non-success return values from GDAL and OGR to blow
an exception if you make a particular call.

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 Programmer for Rent




More information about the Gdal-dev mailing list