Skip to content

Commit

Permalink
Merge pull request #30098 from elpaso/bugfix-gh30050-gpkg-drag-and-drop
Browse files Browse the repository at this point in the history
Get raster layer name when d&d gpkg, also open vectors in addition to…
  • Loading branch information
elpaso committed Jun 7, 2019
2 parents 96c3357 + c5f7e30 commit 613f304
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -5000,7 +5000,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 @@ -6498,7 +6508,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 613f304

Please sign in to comment.