[QGIS-Developer] GetFeatureInfo, difference between JSON/XML

Tom Palan thomas at palan.at
Sun Apr 19 06:04:01 PDT 2020


Hi,

could somebody please explain why the fetching of a GetFeatureInfo
request in application/json format instead of text/xml does need to
query the layer again to get the feature values, again?

I am talking about qgswmsrenderer.cpp, method convertFeatureInfoToJson,
around line 2167. The conversion to json is the only one that needs to
re-fetch the feature data instead of using the "result" (QDomDocument)
directly.

Is this because we need to get the correct field types for json
conversion instead of returning just string values? Is this a real
necessity?
I noticed this because a postgis layer had problems with its id-column, 
and the json request failed while the xml request worked just fine. Of
course the id-column will be fixed, but the re-fetching of every
feature are also means that in the best case the db-query count goes up
from 1 to 1+<feature-cnt>.

Thanks for your input,
Tom




More information about the QGIS-Developer mailing list