[gdal-dev] Bug in SetField

Even Rouault even.rouault at mines-paris.org
Thu Feb 24 13:58:08 EST 2011


Le jeudi 24 février 2011 18:17:13, Mohammed Rashad a écrit :
> rashadkm at rashad-laptop:~/wt/examples/vrgeo/shp$ ogrinfo -so -al layerff.shp
> ERROR 4: Unable to open layerff.shp or layerff.SHP.
> Had to open data source read-only.
> INFO: Open of `layerff.shp'
>       using driver `ESRI Shapefile' successful.
> 
> Layer name: layerff
> Geometry: Polygon
> Feature Count: 5
> Extent: (76.199480, 9.727064) - (76.863570, 10.255923)
> Layer SRS WKT:
> (unknown)
> fieldname: String (1.0)

Yes that matches Frank hypothesis !

> rashadkm at rashad-laptop:~/wt/examples/vrgeo/shp$
> 
> 
> but i had set the feild width to 132
> 
>     OGRFieldDefn oField( field, OFTString );
> 
>     oField.SetWidth(132);

You cannot change a field definition of an existing file. You can only set it 
when creating a new field with the OGRLayer::CreateField() API


More information about the gdal-dev mailing list