OGRFeature* feature = new OGRFeature(layer->GetLayerDefn()); feature->SetFID(123);
for(int i = 0; i < features->GetFeatureCount(); i++) { OGRFeature* feature = features->GetFeature(i); feature->SetFID(i+1); featuresLayer->CreateFeature(feature); }Briefly: The first example sets the FID of a feature object to a specific value, while the second example sets the FID of each feature object to be its index in the feature collection. Both examples use the SetFID method, which belongs to OGRFeature class. Package library: The OGR library is a C++ library that provides access to geospatial data formats.