Skip to content

Commit

Permalink
Merge pull request #58168 from alexbruy/datasource-manager-metadata-g…
Browse files Browse the repository at this point in the history
…eometry-type

use WKB type instead of geometry type when saving and restoring layer metadata
  • Loading branch information
alexbruy authored Jul 18, 2024
2 parents 2f3bbc6 + 490e7c8 commit 5ea1757
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/providers/postgres/qgspostgresprovidermetadatautils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ QList<QgsLayerMetadataProviderResult> 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 );
Expand Down Expand Up @@ -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 ) };
Expand Down

0 comments on commit 5ea1757

Please sign in to comment.