Skip to content
Permalink
Browse files

Add json export for raster layers

  • Loading branch information
pblottiere committed Jan 18, 2019
1 parent 9eed93b commit 2d8f3d1e938664bf8597ac33c88466376b288758
Showing with 18 additions and 1 deletion.
  1. +18 −1 src/server/services/wms/qgswmsrenderer.cpp
@@ -2343,12 +2343,29 @@ namespace QgsWms
exporter.setIncludeLayerName( true );

if ( i > 0 )
json.append( "," );
json.append( QStringLiteral( "," ) );

json.append( exporter.exportFeatures( features ) );
}
else // raster layer
{
json.append( QStringLiteral( "{" ) );
json.append( QStringLiteral( "\n \"name\": \"%1\",\n" ).arg( layer->name() ) );

const QDomNodeList attributesNode = layerElem.elementsByTagName( QStringLiteral( "Attribute" ) );
for ( int j = 0; j < attributesNode.size(); ++j )
{
const QDomElement attrElmt = attributesNode.at( j ).toElement();
const QString name = attrElmt.attribute( QStringLiteral( "name" ) );
const QString value = attrElmt.attribute( QStringLiteral( "value" ) );

if ( j > 0 )
json.append( QStringLiteral( ",\n" ) );

json.append( QStringLiteral( "\"%1\": \"%2\"" ).arg( name, value ) );
}

json.append( QStringLiteral( "\n}" ) );
}
}

0 comments on commit 2d8f3d1

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