Skip to content

Commit

Permalink
[ogr] Report ESRI multipatch GDB layers as multipolygonz layers
Browse files Browse the repository at this point in the history
Apply the same workaround we use for multipatch shapefiles to
GDB sources
  • Loading branch information
nyalldawson committed Jul 21, 2021
1 parent a80e42b commit 7b283b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/core/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -701,7 +701,11 @@ OGRwkbGeometryType QgsOgrProvider::getOgrGeomType( const QString &driverName, OG
// In such cases, we use virtual sublayers for each geometry if the layer contains
// multiple geometries (see subLayers) otherwise we guess geometry type from the first
// feature that has a geometry (limit us to a few features, not the whole layer)
if ( geomType == wkbUnknown )
//
// For ESRI formats with a GeometryCollection25D type we also query features for the geometry type,
// as they may be ESRI MultiPatch files which we want to report as MultiPolygon25D types
if ( geomType == wkbUnknown
|| ( geomType == wkbGeometryCollection25D && ( driverName == QLatin1String( "ESRI Shapefile" ) || driverName == QLatin1String( "OpenFileGDB" ) || driverName == QLatin1String( "FileGDB" ) ) ) )
{
geomType = wkbNone;
OGR_L_ResetReading( ogrLayer );
Expand Down
4 changes: 2 additions & 2 deletions src/core/providers/ogr/qgsogrproviderutils.cpp
Expand Up @@ -2031,9 +2031,9 @@ OGRwkbGeometryType QgsOgrProviderUtils::resolveGeometryTypeForFeature( OGRFeatur
{
OGRwkbGeometryType gType = OGR_G_GetGeometryType( geom );

// Shapefile MultiPatch can be reported as GeometryCollectionZ of TINZ
// ESRI MultiPatch can be reported as GeometryCollectionZ of TINZ
if ( wkbFlatten( gType ) == wkbGeometryCollection &&
driverName == QLatin1String( "ESRI Shapefile" ) &&
( driverName == QLatin1String( "ESRI Shapefile" ) || driverName == QLatin1String( "OpenFileGDB" ) || driverName == QLatin1String( "FileGDB" ) ) &&
OGR_G_GetGeometryCount( geom ) >= 1 &&
wkbFlatten( OGR_G_GetGeometryType( OGR_G_GetGeometryRef( geom, 0 ) ) ) == wkbTIN )
{
Expand Down

0 comments on commit 7b283b3

Please sign in to comment.