Skip to content

Commit

Permalink
Merge pull request #34033 from elpaso/bugfix-pgraster-wkb-parser
Browse files Browse the repository at this point in the history
PG raster: fix WKB parser band number
  • Loading branch information
elpaso committed Jan 26, 2020
2 parents f82932e + f82298f commit b8f1d25
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/providers/postgres/raster/qgspostgresrasterutils.cpp
Expand Up @@ -18,7 +18,6 @@
#include "qgspostgresrasterutils.h"
#include "qgsmessagelog.h"


QVariantMap QgsPostgresRasterUtils::parseWkb( const QByteArray &wkb, int bandNo )
{
QVariantMap result;
Expand Down Expand Up @@ -53,8 +52,7 @@ QVariantMap QgsPostgresRasterUtils::parseWkb( const QByteArray &wkb, int bandNo
// TODO: endianness
Q_ASSERT( result[ QStringLiteral( "endiannes" ) ] == 1 ); //#spellok
result[ QStringLiteral( "version" ) ] = *reinterpret_cast<const unsigned short int *>( &wkb.constData()[1] );
result[ QStringLiteral( "nBands" ) ] = *reinterpret_cast<const unsigned int *>( &wkb.constData()[3] );
const unsigned int nBands { *reinterpret_cast<const unsigned int *>( &wkb.constData()[3] ) };
const unsigned short int nBands { *reinterpret_cast<const unsigned short int *>( &wkb.constData()[3] ) };
result[ QStringLiteral( "nBands" ) ] = nBands;
result[ QStringLiteral( "scaleX" ) ] = *reinterpret_cast<const double *>( &wkb.constData()[5] );
result[ QStringLiteral( "scaleY" ) ] = *reinterpret_cast<const double *>( &wkb.constData()[13] );
Expand Down

0 comments on commit b8f1d25

Please sign in to comment.