Skip to content

Commit

Permalink
[askUserForOGRSublayers] Use layername= instead of layerid= when no a…
Browse files Browse the repository at this point in the history
…mbiguity (#16135)

Complementary fix to 1822b76 for the case
where a layer has mixed geometry types.
  • Loading branch information
rouault committed Oct 28, 2017
1 parent 071099c commit 24de819
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4542,6 +4542,7 @@ void QgisApp::askUserForOGRSublayers( QgsVectorLayer *layer )
QgsSublayersDialog::LayerDefinitionList list;
QMap< QString, int > mapLayerNameToCount;
bool uniqueNames = true;
int lastLayerId = -1;
Q_FOREACH ( const QString &sublayer, sublayers )
{
// OGR provider returns items in this format:
Expand All @@ -4562,9 +4563,13 @@ void QgisApp::askUserForOGRSublayers( QgsVectorLayer *layer )
def.layerName = elements[1];
def.count = elements[2].toInt();
def.type = elements[3];
int count = ++mapLayerNameToCount[def.layerName];
if ( count > 1 || def.layerName.isEmpty() )
uniqueNames = false;
if ( lastLayerId != def.layerId )
{
int count = ++mapLayerNameToCount[def.layerName];
if ( count > 1 || def.layerName.isEmpty() )
uniqueNames = false;
lastLayerId = def.layerId;
}
list << def;
}
else
Expand Down

0 comments on commit 24de819

Please sign in to comment.