I want my mapfile to support the GetFeatureInfo-request for some layers.
I added the following line to the layer:
The example below shows country borders etc so just head to the US/Canada border for something to click on. I suspect your issue is that GetFeatureInfo isn't guaranteed to always return something. It's possible to make that call and the WMS server return an exception that GetFeatureInfo is not available for the layer. A WMS (or Web Map Server) allows for use of data from several different servers, and enables for the creation of a network of Map Servers from which clients can build customized maps. The following documentation is based on the Open Geospatial Consortium’s (OGC) Web Map Server Interfaces Implementation Specification v1.1.1.
And the fileitself looks like follows (only for testing-purposes until now):
If I make my GetFeatureInfo-request, I get the following output:
![Mapserver Getfeatureinfo Json Example Mapserver Getfeatureinfo Json Example](/uploads/1/2/4/8/124871050/872195292.png)
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?
MnementhMnementh
1 Answer
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:
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.
MnementhMnementh