Skip to content
Permalink
Browse files

Merge pull request #34033 from elpaso/bugfix-pgraster-wkb-parser

PG raster: fix WKB parser band number
  • Loading branch information
elpaso committed Jan 26, 2020
2 parents f82932e + f82298f commit b8f1d255ce718e07aefb86ac90265e9573ead2fa
Showing with 1 addition and 3 deletions.
  1. +1 −3 src/providers/postgres/raster/qgspostgresrasterutils.cpp
@@ -18,7 +18,6 @@
#include "qgspostgresrasterutils.h"
#include "qgsmessagelog.h"


QVariantMap QgsPostgresRasterUtils::parseWkb( const QByteArray &wkb, int bandNo )
{
QVariantMap result;
@@ -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] );

0 comments on commit b8f1d25

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