mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
GPKG: proper handling of unknown geometry
This handles the test use case for layer: Layer name: geometry2d Geometry: Unknown (any) Feature Count: 8 The browser tree will now show the different geometry layers and allow them to be added in the canvas, GeometryCollections are skipped.
This commit is contained in:
parent
97d168e163
commit
ad2f760c0e
@ -156,11 +156,19 @@ QVector<QgsDataItem *> QgsGeoPackageConnectionItem::createChildren()
|
||||
layerType = layerTypeFromDb( geometryType );
|
||||
if ( layerType != QgsLayerItem::LayerType::NoType )
|
||||
{
|
||||
// example URI: '/path/gdal_sample_v1.2_no_extensions.gpkg|layerid=7'
|
||||
QString uri = QStringLiteral( "%1|layerid=%2" ).arg( mPath, layerId );
|
||||
QgsGeoPackageVectorLayerItem *item = new QgsGeoPackageVectorLayerItem( this, name, mPath, uri, layerType );
|
||||
QgsDebugMsg( QStringLiteral( "Adding GPKG Vector item %1 %2 %3" ).arg( name, uri, geometryType ) );
|
||||
children.append( item );
|
||||
if ( geometryType.contains( QStringLiteral( "Collection" ), Qt::CaseInsensitive ) )
|
||||
{
|
||||
QgsDebugMsgLevel( QStringLiteral( "Layer %1 is a geometry collection: skipping %2" ).arg( name, mPath ), 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// example URI: '/path/gdal_sample_v1.2_no_extensions.gpkg|layerid=7|geometrytype=Point'
|
||||
QString uri = QStringLiteral( "%1|layerid=%2|geometrytype=%3" ).arg( mPath, layerId, geometryType );
|
||||
// TODO?: not sure, but if it's a collection, an expandable node would be better?
|
||||
QgsGeoPackageVectorLayerItem *item = new QgsGeoPackageVectorLayerItem( this, name, mPath, uri, layerType );
|
||||
QgsDebugMsgLevel( QStringLiteral( "Adding GPKG Vector item %1 %2 %3" ).arg( name, uri, geometryType ), 3 );
|
||||
children.append( item );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user