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 <br><br>....<br>ERROR 1: No such field: 'CONTENTS_DAMAGE_fraction'<br>
ERROR 1: No such field: 'STRUCT_INUNDATED'<br>ERROR 1: No such field: 'STRUCT_LOSS_AUD'<br>ERROR 1: No such field: 'CONTENTS_LOSS_AUD'<br>ERROR 1: No such field: 'PEOPLE_AFFECTED'<br>.....<br>
File "/home/nielso/dev/riab/impact/storage/vector.py", line 426, in write_to_file<br> feature.SetField(name, data[i][name])<br> File "/usr/lib/python2.7/dist-packages/osgeo/ogr.py", line 2184, in SetField<br>
return _ogr.Feature_SetField(self, *args)<br>NotImplementedError: Wrong number of arguments for overloaded function 'Feature_SetField'.<br> Possible C/C++ prototypes are:<br> SetField(OGRFeatureShadow *,int,char const *)<br>
SetField(OGRFeatureShadow *,char const *,char const *)<br> SetField(OGRFeatureShadow *,int,int)<br> SetField(OGRFeatureShadow *,char const *,int)<br> SetField(OGRFeatureShadow *,int,double)<br> SetField(OGRFeatureShadow *,char const *,double)<br>
SetField(OGRFeatureShadow *,int,int,int,int,int,int,int,int)<br> SetField(OGRFeatureShadow *,char const *,int,int,int,int,int,int,int)<br><br><br><br>This happened after I (as an unrelated act) installed qgis 1.7 so I am guessing GDAL got upgraded as well.<br>
The arguments to SetField in this case are: SetField('MMI', nan)<br>Types are <br>'MMI' <type 'str'><br>nan <type 'float'><br><br>So does this mean that nan used to be supported and no longer is?<br>
Or is it me doing something wrong.<br><br><br><br>I have seen references to this issue at <br><br><a href="http://osgeo-org.1803224.n2.nabble.com/gdal-dev-Proposed-UTF-8-SWIG-Changes-td5575272.html">http://osgeo-org.1803224.n2.nabble.com/gdal-dev-Proposed-UTF-8-SWIG-Changes-td5575272.html</a><br>
<a href="http://lists.osgeo.org/pipermail/gdal-dev/2010-September/026156.html">http://lists.osgeo.org/pipermail/gdal-dev/2010-September/026156.html</a><br><br>but they seem to be more concerned with defining typemaps in the C libraries. What I need to know is how to modify my <br>
Python code so that this runs again on all relevant gdal versions.<br><br>Can anyone help, please?<br><br>Many thanks<br>Ole Nielsen<br><br>