Skip to content

Commit c5f7e30

Browse files
committedJun 5, 2019
Get raster layer name when d&d gpkg, also open vectors in addition to rasters
Fixes #30050
1 parent 74d6b23 commit c5f7e30

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5002,7 +5002,17 @@ QList< QgsMapLayer * > QgisApp::askUserForGDALSublayers( QgsRasterLayer *layer )
50025002
// for hdf4 it would be best to get description, because the subdataset_index is not very practical
50035003
if ( name.startsWith( QLatin1String( "netcdf" ), Qt::CaseInsensitive ) ||
50045004
name.startsWith( QLatin1String( "hdf" ), Qt::CaseInsensitive ) )
5005+
{
50055006
name = name.mid( name.indexOf( path ) + path.length() + 1 );
5007+
}
5008+
else if ( name.startsWith( QLatin1String( "GPKG" ), Qt::CaseInsensitive ) )
5009+
{
5010+
const auto parts { name.split( ':' ) };
5011+
if ( parts.count() >= 3 )
5012+
{
5013+
name = parts.at( parts.count( ) - 1 );
5014+
}
5015+
}
50065016
else
50075017
{
50085018
// remove driver name and file name
@@ -6500,7 +6510,7 @@ bool QgisApp::openLayer( const QString &fileName, bool allowInteractive )
65006510
}
65016511

65026512
// try as a vector
6503-
if ( !ok )
6513+
if ( !ok || fileName.endsWith( QLatin1String( ".gpkg" ), Qt::CaseInsensitive ) )
65046514
{
65056515
if ( allowInteractive )
65066516
{

0 commit comments

Comments
 (0)
Please sign in to comment.