Skip to content

Commit

Permalink
Let ogr give ids to created features (otherwise, there are problems w…
Browse files Browse the repository at this point in the history
…ith exported dxf files)
  • Loading branch information
mhugent committed Dec 26, 2012
1 parent c74509e commit 891e665
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/core/qgsvectorfilewriter.cpp
Expand Up @@ -502,15 +502,14 @@ OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature )
if ( fid > std::numeric_limits<int>::max() )
{
QgsDebugMsg( QString( "feature id %1 too large." ).arg( fid ) );
}

OGRErr err = OGR_F_SetFID( poFeature, static_cast<long>( fid ) );
if ( err != OGRERR_NONE )
{
QgsDebugMsg( QString( "Failed to set feature id to %1: %2 (OGR error: %3)" )
.arg( feature.id() )
.arg( err ).arg( CPLGetLastErrorMsg() )
);
OGRErr err = OGR_F_SetFID( poFeature, static_cast<long>( fid ) );
if ( err != OGRERR_NONE )
{
QgsDebugMsg( QString( "Failed to set feature id to %1: %2 (OGR error: %3)" )
.arg( feature.id() )
.arg( err ).arg( CPLGetLastErrorMsg() )
);
}
}

// attribute handling
Expand Down

0 comments on commit 891e665

Please sign in to comment.