Skip to content
Permalink
Browse files

[OGR] Followup: Add orig_ogc_fid as last field to avoid changing fiel…

…d order
  • Loading branch information
manisandro committed Sep 25, 2017
1 parent 386d52d commit cf23d56aef0bca6d6f958dd00cc97587dace89e2
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/providers/ogr/qgsogrfeatureiterator.cpp
@@ -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
{

0 comments on commit cf23d56

Please sign in to comment.
You can’t perform that action at this time.