mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-24 00:06:24 -04:00
[OGR] Followup: Add orig_ogc_fid as last field to avoid changing field order
This commit is contained in:
parent
386d52d873
commit
cf23d56aef
@ -346,7 +346,12 @@ bool QgsOgrFeatureIterator::readFeature( OGRFeatureH fet, QgsFeature &feature )
|
||||
{
|
||||
if ( mOrigFidAdded )
|
||||
{
|
||||
feature.setId( OGR_F_GetFieldAsInteger64( fet, 0 ) );
|
||||
OGRFeatureDefnH fdef = OGR_L_GetLayerDefn( ogrLayer );
|
||||
int lastField = OGR_FD_GetFieldCount( fdef ) - 1;
|
||||
if ( lastField >= 0 )
|
||||
feature.setId( OGR_F_GetFieldAsInteger64( fet, lastField ) );
|
||||
else
|
||||
feature.setId( OGR_F_GetFID( fet ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user