Skip to content

Commit

Permalink
[ogr] If we had to do a full table scan to resolve geometry types
Browse files Browse the repository at this point in the history
for a sublayer, ensure that we store the geometry type in the
sublayer uri so that we don't have to do this scan again
when the sublayer uri is used to create a map layer
  • Loading branch information
nyalldawson committed Aug 19, 2021
1 parent 8568ed0 commit 011aa46
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/providers/ogr/qgsogrproviderutils.cpp
Expand Up @@ -2480,7 +2480,10 @@ QList< QgsProviderSublayerDetails > QgsOgrProviderUtils::querySubLayerList( int
details.setProviderKey( QStringLiteral( "ogr" ) );
details.setDriverName( driverName );

if ( fCount.size() > 1 )
// if we had to iterate through the table to find geometry types, make sure to include these
// in the uri for the sublayers (otherwise we'll be forced to re-do this iteration whenever
// the uri from the sublayer is used to construct an actual vector layer)
if ( details.wkbType() != QgsWkbTypes::Unknown )
parts.insert( QStringLiteral( "geometryType" ), ogrWkbGeometryTypeName( countIt.key() ) );
else
parts.remove( QStringLiteral( "geometryType" ) );
Expand Down

0 comments on commit 011aa46

Please sign in to comment.