Skip to content

Commit

Permalink
postgres provider: restore behaviour to keep 3d wkb (refs #9651,
Browse files Browse the repository at this point in the history
followup bd311c8)
  • Loading branch information
jef-n committed Mar 3, 2015
1 parent bd311c8 commit 9ed98a0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/providers/postgres/qgspostgresconn.cpp
Expand Up @@ -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;
Expand All @@ -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() )
Expand Down Expand Up @@ -1303,10 +1305,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)" )

This comment has been minimized.

Copy link
@strk

strk Mar 4, 2015

Contributor

was this intentional ?

This comment has been minimized.

Copy link
@strk

strk Mar 4, 2015

Contributor

sorry, now (that you pointed out in IRC) I see there was already a comma added in the line above

.arg( majorVersion() < 2 ? "ndims" : "st_ndims" )
.arg( quotedIdentifier( layerProperty.geometryColName ) )
.arg( layerProperty.geometryColType == sctGeography ? "::geometry" : "" );
Expand All @@ -1325,10 +1326,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() )
Expand Down

0 comments on commit 9ed98a0

Please sign in to comment.