Skip to content

Commit

Permalink
Get pk attributes from layer instead of provider
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jan 5, 2019
1 parent 69de8f9 commit 10cbad7
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/server/services/wms/qgswmsrenderer.cpp
Expand Up @@ -395,14 +395,8 @@ namespace QgsWms
throw QgsBadRequestException( QStringLiteral( "AtlasPrintError" ),
QStringLiteral( "The atlas has no coverage layer" ) );
}
QgsVectorDataProvider *cProvider = cLayer->dataProvider();
if ( !cProvider )
{
throw QgsBadRequestException( QStringLiteral( "AtlasPrintError" ),
QStringLiteral( "An error occured during the Atlas print" ) );
}

QgsAttributeList pkIndexes = cProvider->pkAttributeIndexes();
QgsAttributeList pkIndexes = cLayer->primaryKeyAttributes();
if ( pkIndexes.size() < 1 )
{
throw QgsBadRequestException( QStringLiteral( "AtlasPrintError" ),
Expand All @@ -411,7 +405,7 @@ namespace QgsWms
QStringList pkAttributeNames;
for ( int i = 0; i < pkIndexes.size(); ++i )
{
pkAttributeNames.append( cProvider->fields()[pkIndexes.at( i )].name() );
pkAttributeNames.append( cLayer->fields()[pkIndexes.at( i )].name() );
}

int nAtlasFeatures = atlasPk.size() / pkIndexes.size();
Expand Down

0 comments on commit 10cbad7

Please sign in to comment.