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

(cherry picked from commit 7b283b3)
  • Loading branch information
nyalldawson committed Jul 22, 2021
1 parent 9914d4b commit cb36726
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/core/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -1061,7 +1061,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 All @@ -1076,9 +1080,9 @@ OGRwkbGeometryType QgsOgrProvider::getOgrGeomType( const QString &driverName, OG
{
geomType = OGR_G_GetGeometryType( geometry );

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

0 comments on commit cb36726

Please sign in to comment.