Skip to content
Permalink
Browse files

[postgres] Fix detection of 2.5D layer types

  • Loading branch information
mhugo committed Jan 20, 2016
1 parent 5f310a7 commit 2ebd26a9add107b86e5ae2de0933637608e928b2
@@ -543,7 +543,7 @@ QString QgsDataSourceURI::uri( bool expandAuthConfig ) const
if ( mWkbType != QGis::WKBUnknown && mWkbType != QGis::WKBNoGeometry )
{
theUri += " type=";
theUri += QgsWKBTypes::displayString( QgsWKBTypes::flatType(( QgsWKBTypes::Type( mWkbType ) ) ) );
theUri += QgsWKBTypes::displayString( QgsWKBTypes::Type( mWkbType ) );
}

if ( mSelectAtIdDisabled )
@@ -523,6 +523,10 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP
layerProperty.tableName = tableName;
layerProperty.geometryColName = column;
layerProperty.geometryColType = columnType;
if ( dim == 3 && !type.endsWith( 'M' ) )
type += "Z";
else if ( dim == 4 )
type += "ZM";
layerProperty.types = QList<QGis::WkbType>() << ( QgsPostgresConn::wkbTypeFromPostgis( type ) );
layerProperty.srids = QList<int>() << srid;
layerProperty.sql = "";
@@ -2955,6 +2955,12 @@ bool QgsPostgresProvider::getGeometryDetails()
if ( result.PQntuples() == 1 )
{
detectedType = result.PQgetvalue( 0, 0 );
QString dim = result.PQgetvalue( 0, 2 );
if ( dim == "3" && !detectedType.endsWith( 'M' ) )
detectedType += "Z";
else if ( dim == "4" )
detectedType += "ZM";

detectedSrid = result.PQgetvalue( 0, 1 );
mSpatialColType = sctGeometry;
}

0 comments on commit 2ebd26a

Please sign in to comment.
You can’t perform that action at this time.