[gdal-dev] Fwd: NotImplementedError: Wrong number of arguments for overloaded function 'Feature_SetField'.

Ole Nielsen ole.moller.nielsen at gmail.com
Thu Sep 1 20:56:58 EDT 2011


Thank you very much for replying.
The output I got from you suggestion is

nielso at shakti:~$ dpkg -l|grep gdal
ii  gdal-bin
1.8.0-2~natty2                             Geospatial Data Abstraction
Library - Utility programs
ii  libgdal1-1.6.0
1.6.3-4build3                              Geospatial Data Abstraction
Library
ii  libgdal1-1.6.0-grass
1.6.3-3                                    GRASS extension for the GDAL
library
ii  libgdal1-1.8.0
1.8.0-2~natty2                             Geospatial Data Abstraction
Library
ii  python-gdal
1.8.0-2~natty2                             Python bindings to the Geospatial
Data Abstraction Library


I think the versions 1.6 would be those coming natively with Ubuntu Natty
while the 1.8 stream may have been installed by qgis 1.7
Is there a way of telling which one I am using (both when running
commandline org2org and when importing the ogr module in python)?

Cheers and thanks
Ole


On Thu, Sep 1, 2011 at 7:33 PM, Even Rouault
<even.rouault at mines-paris.org>wrote:

> Selon Ole Nielsen <ole.moller.nielsen at gmail.com>:
>
> > Sorry for the addition, but regarding the issue with SetField, I just had
> > the same error with the inputs
> > SetField('STRUCT_DAMAGE_fraction', 0.346734256639)
> >
> > To repeat, this works on every standard Ubuntu installation I have used
> > (10.04, 10.10, 11.04). However, after installing qgis 1.7 on Ubuntu 11.04
> > this error keeps happening in our code. I don't know how to find out what
> > version of org we are using.
>
> My feeling is that there must be something broken in your installation.
> This
> should work. Check that both your gdal lib and gdal python packages are
> updated
> at the same version. dpkg -l|grep gdal should give you some hints.
>
> >
> > Please let me know how to work around this or if there is a patch you can
> > apply.
> >
> > Cheers and thanks
> > Ole
> >
> >
> >
> > ---------- Forwarded message ----------
> > From: Ole Nielsen <ole.moller.nielsen at gmail.com>
> > Date: Thu, Sep 1, 2011 at 4:04 PM
> > Subject: NotImplementedError: Wrong number of arguments for overloaded
> > function 'Feature_SetField'.
> > To: gdal-dev at lists.osgeo.org
> > Cc: Ariel Nunez <ingenieroariel at gmail.com>, Ted Dunstone <
> ted at biometix.com>
> >
> >
> > Developing on a code which relies on ogr.py and that has been running for
> a
> > while on Ubuntu 10.04, 10.10 and 11.04 I saw for the first time today the
> > error
> >
> > ....
> > ERROR 1: No such field: 'CONTENTS_DAMAGE_fraction'
> > ERROR 1: No such field: 'STRUCT_INUNDATED'
> > ERROR 1: No such field: 'STRUCT_LOSS_AUD'
> > ERROR 1: No such field: 'CONTENTS_LOSS_AUD'
> > ERROR 1: No such field: 'PEOPLE_AFFECTED'
> > .....
> >   File "/home/nielso/dev/riab/impact/storage/vector.py", line 426, in
> > write_to_file
> >     feature.SetField(name, data[i][name])
> >   File "/usr/lib/python2.7/dist-packages/osgeo/ogr.py", line 2184, in
> > SetField
> >     return _ogr.Feature_SetField(self, *args)
> > NotImplementedError: Wrong number of arguments for overloaded function
> > 'Feature_SetField'.
> >   Possible C/C++ prototypes are:
> >     SetField(OGRFeatureShadow *,int,char const *)
> >     SetField(OGRFeatureShadow *,char const *,char const *)
> >     SetField(OGRFeatureShadow *,int,int)
> >     SetField(OGRFeatureShadow *,char const *,int)
> >     SetField(OGRFeatureShadow *,int,double)
> >     SetField(OGRFeatureShadow *,char const *,double)
> >     SetField(OGRFeatureShadow *,int,int,int,int,int,int,int,int)
> >     SetField(OGRFeatureShadow *,char const *,int,int,int,int,int,int,int)
> >
> >
> >
> > This happened after I (as an unrelated act) installed qgis 1.7 so I am
> > guessing GDAL got upgraded as well.
> > The arguments to SetField in this case are: SetField('MMI', nan)
> > Types are
> > 'MMI' <type 'str'>
> > nan <type 'float'>
> >
> > So does this mean that nan used to be supported and no longer is?
> > Or is it me doing something wrong.
> >
> >
> >
> > I have seen references to this issue at
> >
> >
>
> http://osgeo-org.1803224.n2.nabble.com/gdal-dev-Proposed-UTF-8-SWIG-Changes-td5575272.html
> > http://lists.osgeo.org/pipermail/gdal-dev/2010-September/026156.html
> >
> > but they seem to be more concerned with defining typemaps in the C
> > libraries. What I need to know is how to modify my
> > Python code so that this runs again on all relevant gdal versions.
> >
> > Can anyone help, please?
> >
> > Many thanks
> > Ole Nielsen
> >
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110902/dde4f2ea/attachment.html


More information about the gdal-dev mailing list