Skip to content

Commit

Permalink
OGR layers with unknown geometry type containing single geometry type…
Browse files Browse the repository at this point in the history
… fix, fixes #7995
  • Loading branch information
blazek committed Jun 4, 2013
1 parent 66feeb6 commit 383e7f1
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -559,14 +559,17 @@ QStringList QgsOgrProvider::subLayers() const
}
OGR_L_ResetReading( ogrLayer );
int i = 0;
foreach ( OGRwkbGeometryType gType, fCount.keys() )
if ( fCount.size() > 1 )
{
QString geom = ogrWkbGeometryTypeName( gType );
foreach ( OGRwkbGeometryType gType, fCount.keys() )
{
QString geom = ogrWkbGeometryTypeName( gType );

QString sl = QString( "%1:%2:%3:%4" ).arg( i ).arg( theLayerName ).arg( fCount.value( gType ) ).arg( geom );
QgsDebugMsg( "sub layer: " + sl );
mSubLayerList << sl;
i++;
QString sl = QString( "%1:%2:%3:%4" ).arg( i ).arg( theLayerName ).arg( fCount.value( gType ) ).arg( geom );
QgsDebugMsg( "sub layer: " + sl );
mSubLayerList << sl;
i++;
}
}
}
}
Expand Down Expand Up @@ -602,10 +605,9 @@ int QgsOgrProvider::getOgrGeomType( OGRLayerH ogrLayer )
{
geomType = OGR_FD_GetGeomType( fdef );

//Some ogr drivers (e.g. GML) are not able to determine the geometry type of a layer like this.
//In such cases, we use virtual sublayers for each geometry (originally the type was
// guessed from the first feature which resulted in loss of other formats)
/*
// Some ogr drivers (e.g. GML) are not able to determine the geometry type of a layer like this.
// In such cases, we use virtual sublayers for each geometry if the layer contains
// multiple geometries (see subLayers) otherwise we guess geometry type from first feature
if ( geomType == wkbUnknown )
{
OGR_L_ResetReading( ogrLayer );
Expand All @@ -621,7 +623,6 @@ int QgsOgrProvider::getOgrGeomType( OGRLayerH ogrLayer )
}
OGR_L_ResetReading( ogrLayer );
}
*/
}
return geomType;
}
Expand Down

0 comments on commit 383e7f1

Please sign in to comment.