1

I am using MapServer 7.4.2 and I am trying to setup a WMS GetFeatureInfo using OUTPUTFORMAT instead of direct TEMPLATE but variables are not replaced

On MapServer file layer definition using:

TEMPLATE 'html.tmpl'

and with a html.tmpl:

<!-- MapServer Template -->
:
<b>Value: </b>[value_0]<br>
:

I have the proper value reply on QGIS 2.18

Value:125

When I try to implement it by replacing the template location with

TEMPLATE 'getfeatureinfo_html'

and creating an OUTPUTFORMAT option as follows

OUTPUTFORMAT
 NAME "getfeatureinfo_html"
 DRIVER "TEMPLATE"
 FORMATOPTION "FILE=html.tmpl"
 MIMETYPE "text/html"
END

The server replies with the correct template BUT the variable is not replaced, resulting in an output like:

<b>Value: </b>[value_0]<br>

Therefore the variable is not being replace and on logs (level 5) I have no indication or an error.

It looks like MapServer is not aware the layer from where to pull the value. Looked at documentation and examples but is not clear how to achieve it (missing layer information).

Later I would like to have a GetFeatureInfo for WMS with multiple mimetype options

Any tips or solutions?

1

It looks like MapServer is not aware the layer from where to pull the value

You need to reference the template in the layer like:

LAYER
     NAME "GBR_BGS_625k_BLT" #Bedrock lithology
     TYPE POLYGON
     STATUS ON
     DATA "bedrock625ll"
     TRANSPARENCY 100
     TOLERANCE 0
     TOLERANCEUNITS pixels
     TRANSFORM TRUE
     PROCESSING "CLOSE_CONNECTION=DEFER"
     HEADER "tmpl/bedrock_lithology_query_header.html"
     TEMPLATE "tmpl/bedrock_lithology_query_body.html"
     FOOTER "tmpl/bedrock_lithology_query_footer.html"
     PROJECTION
         ...
| improve this answer | |

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.