Skip to content
Permalink
Browse files

postgres provider: restore behaviour to keep 3d wkb (refs #9651,

followup bd311c8)
  • Loading branch information
jef-n authored and Sandro Santilli committed Mar 3, 2015
1 parent c5ce267 commit c7234cee23aae55d1bacc4f59b9450c96efdaabd
Showing with 10 additions and 10 deletions.
  1. +10 −10 src/providers/postgres/qgspostgresconn.cpp
@@ -454,13 +454,15 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP
srid = INT_MIN;
}

/*QgsDebugMsg( QString( "%1 : %2.%3.%4: %5 %6 %7 %8" )
#if 0
QgsDebugMsg( QString( "%1 : %2.%3.%4: %5 %6 %7 %8" )
.arg( gtableName )
.arg( schemaName ).arg( tableName ).arg( column )
.arg( type )
.arg( srid )
.arg( relkind )
.arg( dim ) );*/
.arg( dim ) );
#endif

layerProperty.schemaName = schemaName;
layerProperty.tableName = tableName;
@@ -470,11 +472,11 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP
layerProperty.srids = QList<int>() << srid;
layerProperty.sql = "";
/*
* NOTE: force2d may get a false negative value
* force2d may get a false negative value
* (dim == 2 but is not really constrained)
* http://trac.osgeo.org/postgis/ticket/3068
*/
layerProperty.force2d = dim > 2;
layerProperty.force2d = dim > 3;
addColumnInfo( layerProperty, schemaName, tableName, isView );

if ( isView && layerProperty.pkCols.empty() )
@@ -1304,10 +1306,9 @@ void QgsPostgresConn::retrieveLayerTypes( QgsPostgresLayerProperty &layerPropert
query += QString::number( srid );
}

if ( ! layerProperty.force2d )
if ( !layerProperty.force2d )
{
query += ",";
query += QString( "%1(%2%3)" )
query += QString( ",%1(%2%3)" )
.arg( majorVersion() < 2 ? "ndims" : "st_ndims" )
.arg( quotedIdentifier( layerProperty.geometryColName ) )
.arg( layerProperty.geometryColType == sctGeography ? "::geometry" : "" );
@@ -1326,10 +1327,9 @@ void QgsPostgresConn::retrieveLayerTypes( QgsPostgresLayerProperty &layerPropert
QString type = gresult.PQgetvalue( i, 0 );
QString srid = gresult.PQgetvalue( i, 1 );

if ( ! layerProperty.force2d )
if ( !layerProperty.force2d && gresult.PQgetvalue( i, 2 ).toInt() > 3 )
{
QString ndims = gresult.PQgetvalue( i, 2 );
if ( ndims.toInt() > 2 ) layerProperty.force2d = true;
layerProperty.force2d = true;
}

if ( type.isEmpty() )

0 comments on commit c7234ce

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