1

I have a qgis-server instance. In my GetCapabilities request I can see these formats available for the GetFeatureInfo:

<GetFeatureInfo>
   <Format>text/plain</Format>
   <Format>text/html</Format>
   <Format>text/xml</Format>
   <Format>application/vnd.ogc.gml</Format>
   <Format>application/vnd.ogc.gml/3.1.1</Format>
[...]

I would like to add the application/json format. What is the approach?

Can I use the qgis plugins?

2

Yes, you can. I'd suggest you to start from the XML or the text format and turn it into json.

Here is an example of how to proceed (this example does something different but you get the idea): http://www.itopen.it/qgis-server-getfeatureinfo-with-style/lang-pref/en/

Update:

You need to transform the input format to xml before entering into the main loop using a requestReady hook: there is no json support inside qgis server. At the end of the a.m. linked page there is an hint about how to do that, left as an exercise for the reader

  • Uhm... it's exactly what I done, starting from your code: gist.github.com/marciuz/84e8c7c9ab87fc37589127965896fc91 The problems seems to be in the allowed formats. – Marcello Verona Oct 5 '16 at 16:10
  • 1
    You need to transform the input format to xml before entering into the main loop using a requestReady hook: there is no json support inside qgis server. At the end of the a.m. linked page there is an hint about how to do that, left as an exercise for the reader. – elpaso66 Oct 6 '16 at 8:50
  • In other words, the answer is "No, you can't" ? – Marcello Verona Oct 12 '16 at 15:35
  • 1
    The answer is "Yes, you can" (TM) and you need to write a simple Python plugin. The a.m. link shows exactly how to do it (the transformation in the example is into HTML instead of json but you get the idea). – elpaso66 Oct 19 '16 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.