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?

1 Answer 1

3

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

4
  • 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. Commented Oct 5, 2016 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
    Commented Oct 6, 2016 at 8:50
  • In other words, the answer is "No, you can't" ? Commented Oct 12, 2016 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
    Commented Oct 19, 2016 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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