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 381c8b6 commit 52bdbdf332536cca7c0077deef5852584fb02360
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/providers/ogr/qgsogrfeatureiterator.cpp
@@ -327,11 +327,16 @@ bool QgsOgrFeatureIterator::readFeature( OGRFeatureH fet, QgsFeature& feature )
{
if ( mOrigFidAdded )
{
OGRFeatureDefnH fdef = OGR_L_GetLayerDefn( ogrLayer );
int lastField = OGR_FD_GetFieldCount( fdef ) - 1;
if ( lastField >= 0 )
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 2000000
feature.setFeatureId( OGR_F_GetFieldAsInteger64( fet, 0 ) );
feature.setFeatureId( OGR_F_GetFieldAsInteger64( fet, lastField ) );
#else
feature.setFeatureId( OGR_F_GetFieldAsInteger( fet, 0 ) );
feature.setFeatureId( OGR_F_GetFieldAsInteger( fet, lastField ) );
#endif
else
feature.setFeatureId( OGR_F_GetFID( fet ) );
}
else
{

0 comments on commit 52bdbdf

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