0

I would like to know if it is possible to render directly a HTML template retrieved from a MapServer WMS GetFeatureInfo call.

The documentation explains that the API uses ol.Format.GML2 to read features Here the API DOC. No mention about HTML.

Here the template I would like to render: HTML template by MapServer

I would like to not know if there is a "direct" way, not as shown in this example.

  • I'm not sure what you mean when you say not as shown in this example. In the example it has {'INFO_FORMAT': 'text/html'} which is the HTML response. Did you try it? – nmtoken Apr 10 '17 at 18:02
  • I agree, it's not clear. – PEL Apr 10 '17 at 18:07
  • In this example, openlayers.org/en/latest/examples/… , the response management is seamless. Into the other example (original post), you have to call another parametrer to cast correctly you response. More clear? – PEL Apr 10 '17 at 18:09
  • Can you edit your question to add further details – nmtoken Apr 10 '17 at 18:51
  • In the second example you post there is no GetFeatureInfo request, instead an XML file is parsed which pretends to be the response of a GetFeatureInfo request, where the info_format was GML... – nmtoken Apr 10 '17 at 19:58
1

Looking at this purely from the WMS interface standards perspective, we can see that there is no default format for a GetFeatureInfo request (so if OpenLayers suggests it is GML, then that is a mistake).

Looking at WMS 1.1.1 we can see that the info_format parameter is optional (so any software compliant to this specification can define its own default). As far as I can tell both GeoServer and MapServer default to plain text as the default when making a WMS 1.1.1 GetFeatureInfo request and not specifying the info_format parameter, or specifying the parameter as empty like info_format&

For the WMS 1.3.0 specification there is still no default format specified, but this time there is a requirement to supply an info_format parameter as part of your GetFeatureInfo request.

It might be that OpenLayers defaults to using GML as the info_format for a GetFeatureInfo request, and if so it can only guarantee such a format by requesting it using the info_format parameter.

To ensure an HTML response you would be wise to always specify that format using the INFO_FORMAT=text/html& as part of your GetFeatureInfo request.

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.