[gdal-dev] Bug in SetField

Frank Warmerdam warmerdam at pobox.com
Thu Feb 24 12:09:53 EST 2011


On 11-02-24 11:56 AM, Mohammed Rashad wrote:
> my code
> field - fieldname is of string type and 0th field
>
> poFeature->SetField("fieldname","value");
>
>
> poFeature->GetFieldAsString(0);
> returns  v instead of value;
>
> I dont know is it bug or my problem
>
> but I opened the shapefile in OpenJUMP and QGIS both shows field names as only
> v instead of value
>
> I am working with shapefiles

Mohammed,

What does the ogrinfo report on the field definitions look?

ie.

ogrinfo -so -al abc.shp

I suspect the field "fieldname" was defined with a width of one.  SetField()
will automatically truncate the value in such a case.

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