Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Do not add geometry if not necessary in json export
  • Loading branch information
pblottiere committed Jan 28, 2019
1 parent 101cd73 commit ebd1022
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/server/services/wms/qgswmsrenderer.cpp
Expand Up @@ -2282,6 +2282,8 @@ namespace QgsWms
{
QString json;

const bool withGeometry = ( QgsServerProjectUtils::wmsFeatureInfoAddWktGeometry( *mProject ) && mWmsParameters.withGeometry() );

const QDomNodeList layerList = doc.elementsByTagName( QStringLiteral( "Layer" ) );
for ( int i = 0; i < layerList.size(); ++i )
{
Expand Down Expand Up @@ -2317,7 +2319,7 @@ namespace QgsWms
const QgsFeature feature = vl->getFeature( fid );
features.append( feature );

// search attributes to export
// search attributes to export (one time only)
if ( not attributes.isEmpty() )
continue;

Expand All @@ -2335,6 +2337,7 @@ namespace QgsWms
// export
QgsJsonExporter exporter( vl );
exporter.setAttributes( attributes );
exporter.setIncludeGeometry( withGeometry );
json.append( exporter.exportFeatures( features ) );
}
else // raster layer
Expand Down

0 comments on commit ebd1022

Please sign in to comment.