[MapServer-users] How to add templates(html) to be use with getFeatureInfo for raster data

Trygve Aspenes trygve at aspenes.priv.no
Fri Mar 24 09:35:15 PDT 2023


Hi Users list!

I'm trying to get getFeatureRequest to reply with a html template with 
pixel values from a geotiff raster image.

I have my layer like this:

   LAYER
     NAME "Overview"
     STATUS ON
     TYPE raster
     TEMPLATE "empty"
     DATA <path to my geotiff image>
     METADATA
       "wms_title" "Overview"
       "wms_timeextent" "2021-08-27T13:20:48Z/2021-08-27T13:20:48Z"
       "wms_enable_request" "*"
     END
     FILTER (`[TIME]` = `2021-08-27T13:20:48Z`)
   END

If I ask for the getcapabilities, the getfeatureinfo looks like this:

     <GetFeatureInfo>
       <Format>text/html</Format>
       <Format>application/vnd.ogc.gml</Format>
       <Format>text/plain</Format>
       <DCPType>
         <HTTP>
           <Get><OnlineResource 
xmlns:xlink="http://www.w3.org/1999/xlink" 
xlink:href="http://localhost:8080/mapserverapi?"/></Get>
           <Post><OnlineResource 
xmlns:xlink="http://www.w3.org/1999/xlink" 
xlink:href="http://localhost:8080/mapserverapi?"/></Post>
         </HTTP>
       </DCPType>
     </GetFeatureInfo>

And if I ask for the getfeatureinfo I get:

GetFeatureInfo results:

Layer 'Overview'
   Feature 0:

So far so good.

But now I want to add a custom template to ultimately give me a html 
template with pixel values. but what ever I try to put in the TEMPLATE 
variable, I dont get any other than the results shown above.

In my LAYER config I try with
TEMPLATE "http://localhost:8080/<my template name>.html"
or
TEMPLATE "<my template name>.html"

but nope.

mapserver is v7.4.3

In the documentation there is something about getfeatureinfo here 
https://mapserver.org/mapfile/cluster.html#handling-getfeatureinfo, but 
that is for cluster so I dont think it applies here.
Something more here 
https://mapserver.org/ogc/wms_server.html#how-does-a-wms-work, but still 
I don't get it.
Some lines after 
https://mapserver.org/ogc/wms_server.html#setup-a-mapfile-for-your-wms 
there is also Configuring for GetFeatureInfo Requests:
Here I learned how to enable the getfeatureinfo. But the examples only 
gives the replies, not how I need to setup my map file.
Also https://mapserver.org/ogc/wms_server.html#sample-wms-server-mapfile 
is nice, But I still don't get it.

Any advise is much appreciated.

Trygve


More information about the MapServer-users mailing list