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

Kobben, Barend (UT-ITC) b.j.kobben at utwente.nl
Fri Mar 24 10:09:16 PDT 2023


The line
TEMPLATE "empty"

Should be
TEMPLATE "<the path to your html template file>"

--
Barend Köbben


On 24/03/2023, 17:48, "MapServer-users" <mapserver-users-bounces at lists.osgeo.org> wrote:

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="https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink&data=05%7C01%7Cb.j.kobben%40utwente.nl%7Ca71634c058d2421f20d508db2c879c59%7C723246a1c3f543c5acdc43adb404ac4d%7C0%7C0%7C638152733187323138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=b1Um6UNYhoT5jVanlyPbiM4W3aHN7eIlSNMu3sVIuQM%3D&reserved=0"
xlink:href="http://localhost:8080/mapserverapi?"/></Get<http://localhost:8080/mapserverapi?%22/%3e%3c/Get>>
           <Post><OnlineResource
xmlns:xlink="https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink&data=05%7C01%7Cb.j.kobben%40utwente.nl%7Ca71634c058d2421f20d508db2c879c59%7C723246a1c3f543c5acdc43adb404ac4d%7C0%7C0%7C638152733187323138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=b1Um6UNYhoT5jVanlyPbiM4W3aHN7eIlSNMu3sVIuQM%3D&reserved=0"
xlink:href="http://localhost:8080/mapserverapi?"/></Post<http://localhost:8080/mapserverapi?%22/%3e%3c/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://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmapserver.org%2Fmapfile%2Fcluster.html%23handling-getfeatureinfo&data=05%7C01%7Cb.j.kobben%40utwente.nl%7Ca71634c058d2421f20d508db2c879c59%7C723246a1c3f543c5acdc43adb404ac4d%7C0%7C0%7C638152733187323138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=uWdSh%2BNpt4m5Q2u8i39XtCWnsnbFzhrGP2DtvO1VRbA%3D&reserved=0, but
that is for cluster so I dont think it applies here.
Something more here
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmapserver.org%2Fogc%2Fwms_server.html%23how-does-a-wms-work&data=05%7C01%7Cb.j.kobben%40utwente.nl%7Ca71634c058d2421f20d508db2c879c59%7C723246a1c3f543c5acdc43adb404ac4d%7C0%7C0%7C638152733187323138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=FhVwEX6uJgfDF7LXIiUei68dGgYM1kXP0laJ2s58m1Y%3D&reserved=0, but still
I don't get it.
Some lines after
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmapserver.org%2Fogc%2Fwms_server.html%23setup-a-mapfile-for-your-wms&data=05%7C01%7Cb.j.kobben%40utwente.nl%7Ca71634c058d2421f20d508db2c879c59%7C723246a1c3f543c5acdc43adb404ac4d%7C0%7C0%7C638152733187323138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=KvCsFuN%2BE8sKZpxlGvf9X2vTPE6zWlJxGw2GuOzxSAs%3D&reserved=0
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://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmapserver.org%2Fogc%2Fwms_server.html%23sample-wms-server-mapfile&data=05%7C01%7Cb.j.kobben%40utwente.nl%7Ca71634c058d2421f20d508db2c879c59%7C723246a1c3f543c5acdc43adb404ac4d%7C0%7C0%7C638152733187323138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=8e9FKztuVma73pzpqXu8vKJtCwwtBSjdA7ndZedTjnM%3D&reserved=0
is nice, But I still don't get it.

Any advise is much appreciated.

Trygve
_______________________________________________
MapServer-users mailing list
MapServer-users at lists.osgeo.org
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fmapserver-users&data=05%7C01%7Cb.j.kobben%40utwente.nl%7Ca71634c058d2421f20d508db2c879c59%7C723246a1c3f543c5acdc43adb404ac4d%7C0%7C0%7C638152733187323138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=sYLWKm4FJmM665EGV68H4GKS1azKs0YJtVx5WPSxfqA%3D&reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20230324/a2335798/attachment-0001.htm>


More information about the MapServer-users mailing list