Mapserver ignores my template-file for GetFeatureInfo-requests

2.7k views Asked by At

I want my mapfile to support the GetFeatureInfo-request for some layers.

I added the following line to the layer:

TEMPLATE "change-template.txt"

And the fileitself looks like follows (only for testing-purposes until now):

# MapServer Template

[version]
test123

If I make my GetFeatureInfo-request, I get the following output:

GetFeatureInfo results:

Layer 'Change-North'
  Feature 3150: 

So it hits a feature (if I change the coordinates I get different Feature-numbers), but I cannot get any stuff from my template. The mapserver respects my TEMPLATE-line, because if I comment it out, the GetFeatureInfo-request doesn't work any longer: 'Requested layer(s) are not queryable.'

What is wrong here?

1

There are 1 answers

0
Mnementh On

OK, I found a solution myself now. This template will only be used with a GetFeatureInfo​ request with the parameter INFO_FORMAT set to text/html. But to support text/html you also have to set another value in the WEB-part of the mapfile:

    WEB
            METADATA
                    "WMS_FEATURE_INFO_MIME_TYPE" "text/html"
            END
    END

Also it only worked, if the name of the template-file ended with .html. But I'm using it to send back simple text-information. Hope this helps anyone, who runs into the same problem.