[gdal-dev] Update existing shape file

Mateusz Loskot mateusz at loskot.net
Fri Aug 1 11:11:46 EDT 2008


Frank Warmerdam wrote:
> wow wrote:
>> Hi,
>>   I wanna set new field value to an existing shape file which has been
>> opened with update access, but it doesn't work, my code like this:
>>  
>>   OGRFeature* pFeature = pLayer->GetFeature(2);   int nIdx =
>> pFeature->GetFieldIndex("Name");
>>  pFeature->UnsetField(nIdx);
>>  pFeature->SetField( "Name", "hanJ reiver" );
>>  
>>   Anyone give me some advices?
> 
> Chen Xuexia,
> 
> After modifying the in memory feature, you need to write it back to the
> file using OGRLayer::SetFeature().

Frank,

SyncToDisk has no effect here?

Ciao,
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org


More information about the gdal-dev mailing list