Skip to content
Permalink
Browse files

[askUserForOGRSublayers] Use layername= instead of layerid= when no a…

…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 24de8195449e9782f213a3f51c38ab13089a65ca
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/app/qgisapp.cpp
@@ -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:
@@ -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

0 comments on commit 24de819

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