From 490e7c8beb5a6f5e519474d00ce41ee625493a11 Mon Sep 17 00:00:00 2001 From: Alexander Bruy Date: Thu, 18 Jul 2024 09:39:35 +0100 Subject: [PATCH] use WKB type instead of geometry type when saving and restoring layer metadata --- src/providers/postgres/qgspostgresprovidermetadatautils.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/providers/postgres/qgspostgresprovidermetadatautils.cpp b/src/providers/postgres/qgspostgresprovidermetadatautils.cpp index 2681a0c26983..bae7530e822e 100644 --- a/src/providers/postgres/qgspostgresprovidermetadatautils.cpp +++ b/src/providers/postgres/qgspostgresprovidermetadatautils.cpp @@ -102,8 +102,10 @@ QList QgsPostgresProviderMetadataUtils::searchLa uri.setSchema( res.PQgetvalue( row, 1 ) ); uri.setTable( res.PQgetvalue( row, 2 ) ); uri.setGeometryColumn( res.PQgetvalue( row, 3 ) ); + const Qgis::WkbType wkbType = QgsWkbTypes::parseType( res.PQgetvalue( row, 7 ) ); + uri.setWkbType( wkbType ); result.setStandardUri( QStringLiteral( "http://mrcc.com/qgis.dtd" ) ); - result.setGeometryType( QgsWkbTypes::geometryType( QgsWkbTypes::parseType( res.PQgetvalue( row, 7 ) ) ) ); + result.setGeometryType( QgsWkbTypes::geometryType( wkbType ) ); QgsPolygon geographicExtent; geographicExtent.fromWkt( res.PQgetvalue( row, 8 ) ); result.setGeographicExtent( geographicExtent ); @@ -207,7 +209,7 @@ bool QgsPostgresProviderMetadataUtils::saveLayerMetadata( const Qgis::LayerType } } - const QString wkbTypeString = QgsWkbTypes::geometryDisplayString( QgsWkbTypes::geometryType( dsUri.wkbType() ) ); + const QString wkbTypeString = QgsWkbTypes::displayString( dsUri.wkbType() ); const QgsCoordinateReferenceSystem metadataCrs { metadata.crs() }; QgsCoordinateReferenceSystem destCrs {QgsCoordinateReferenceSystem::fromEpsgId( 4326 ) };