venerdì 8 agosto 2014

qgis-server: remove maptip virtual field added to a getfeatureinfo response.

#1:

QGIS-Server add a ridicolous "maptip" attribute to some response of GetFeatureInfo request.
Is quite impossile to understand why it add it.  I almost was not capable to undestand why.
:))
 
I try also to undesrad why some layer yes and some other layer no, but was not capable to undestand this.
I try to ask to the ML of qgis (user and dev), but no response to this requests.
And this is the more clear explanation of what is this MapTIP virtual field added.

SO , I guess the strategy to add that field is quite wrong, infact often add it when not requested.

Perhaps it is useful for the specific qgis-server client, but absolutely unuseful for a standard WMS client.
So the better and rapid solution,
Is remove it and recompile qgis.


To do this:
-----------------------------------------------------------------
Open
QuantumGIS/src/mapserver/qgswmsserver.cpp

around line 1812

comment all this code:

      //add maptip attribute based on html/expression (in case there is no maptip attribute)
//      if ( layer->fieldNameIndex( layer->displayField() ) < 0 )
//      {
//        QString displayField = layer->displayField();
//        if ( !displayField.isEmpty() )
//        {
//          QDomElement maptipElem = infoDocument.createElement( "Attribute" );
//          maptipElem.setAttribute( "name", "maptip" );
//          maptipElem.setAttribute( "value",  QgsExpression::replaceExpressionText( displayField, &feature, layer ) );
//          featureElement.appendChild( maptipElem );
//        }
//      }

Ok, after this, go around line 2906 and comment also this code:

  //add maptip attribute based on html/expression (in case there is no maptip attribute)
//  if ( layer->fieldNameIndex( layer->displayField() ) < 0 )
//  {
//    QString displayField = layer->displayField();
//    if ( !displayField.isEmpty() )
//    {
//      QString fieldTextString = QgsExpression::replaceExpressionText( displayField, feat, layer );
//      QDomElement fieldElem = doc.createElement( "qgs:maptip" );
//      QDomText maptipText = doc.createTextNode( fieldTextString );
//      fieldElem.appendChild( maptipText );
//      typeNameElement.appendChild( fieldElem );
//    }
//  }

And after this you can recompile the qgi happy that the stupid maptip field is no more in the

Et-Voila'.
.

Nessun commento:

Posta un commento