[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 13:49:40 PDT 2023


Thanks

I have already tried all kind of options with template and filenames.
What I was missing was the query option "info_format=text/html" doing 
eg. curl.

So my setup was working all the time, but my test curl was wrong.

Trygve

Den 2023-03-24 18:09, skrev Kobben, Barend (UT-ITC):
> 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 [1]>
>            <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 [2]>
>          </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
> [3]
> 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
> 
> 
> Links:
> ------
> [1] http://localhost:8080/mapserverapi?%22/%3e%3c/Get
> [2] http://localhost:8080/mapserverapi?%22/%3e%3c/Post
> [3] 
> 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


More information about the MapServer-users mailing list