Skip to content

Commit

Permalink
Get raster layer name when d&d gpkg, also open vectors in addition to…
Browse files Browse the repository at this point in the history
… rasters

Fixes #30050
  • Loading branch information
elpaso authored and nyalldawson committed Jun 7, 2019
1 parent 59bda59 commit 9a5b557
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -4969,7 +4969,17 @@ QList< QgsMapLayer * > QgisApp::askUserForGDALSublayers( QgsRasterLayer *layer )
// for hdf4 it would be best to get description, because the subdataset_index is not very practical
if ( name.startsWith( QLatin1String( "netcdf" ), Qt::CaseInsensitive ) ||
name.startsWith( QLatin1String( "hdf" ), Qt::CaseInsensitive ) )
{
name = name.mid( name.indexOf( path ) + path.length() + 1 );
}
else if ( name.startsWith( QLatin1String( "GPKG" ), Qt::CaseInsensitive ) )
{
const auto parts { name.split( ':' ) };
if ( parts.count() >= 3 )
{
name = parts.at( parts.count( ) - 1 );
}
}
else
{
// remove driver name and file name
Expand Down Expand Up @@ -6384,7 +6394,7 @@ bool QgisApp::openLayer( const QString &fileName, bool allowInteractive )
}

// try as a vector
if ( !ok )
if ( !ok || fileName.endsWith( QLatin1String( ".gpkg" ), Qt::CaseInsensitive ) )
{
if ( allowInteractive )
{
Expand Down

0 comments on commit 9a5b557

Please sign in to comment.