<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-2"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"Formátovaný v HTML Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.StylE-mailovZprvy17
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.StylE-mailovZprvy18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.FormtovanvHTMLChar
{mso-style-name:"Formátovaný v HTML Char";
mso-style-priority:99;
mso-style-link:"Formátovaný v HTML";
font-family:"Courier New";}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=CS link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Hi all,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>I’ve been trying to make mapserver return wms getfeatureinfo as json but to no success (so far I’ve been using text/html header, content, footer templates).<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>I followed instructions here: <a href="http://mapserver.org/output/template_output.html">http://mapserver.org/output/template_output.html</a> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>My mapfile looks like this: <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>MAP<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>…<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>OUTPUTFORMAT<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> NAME "geojson"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> DRIVER "TEMPLATE"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> MIMETYPE "application/json"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> FORMATOPTION "FILE=template/geojson.js"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>END<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>…<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> WEB<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>…<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> QUERYFORMAT "geojson"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>…<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> LAYER<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>TEMPLATE "template/geojson.js"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> METADATA<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>wms_enable_request" "*"<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>wms_feature_info_mime_type" "gml text/html text/plain"<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>…<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>As a template I used a slightly modified version of JSON example found here <a href="http://mapserver.org/output/template_output.html%23examples">http://mapserver.org/output/template_output.html#examples</a>: <o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>// mapserver template<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>[resultset layer=mums]<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>{<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> "type": "FeatureCollection",<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> "features": [<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> [feature trimlast=","]<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> {<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> "type": "Feature",<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> "id": "[myuniqueid]",<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> "geometry": {<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> "type": "PointLineString",<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> "coordinates": [<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> {<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> "type": "Point",<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> "coordinates": [[x], [y]]<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> }<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> ]<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> },<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> "properties": {<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> "description": "[description]",<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> "venue": "[venue]",<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> "year": "[year]"<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> }<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> },<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> [/feature]<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'> ]<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>}<o:p></o:p></span></p><p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>[/resultset]<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>According to the instruction I added this </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>layer=mums&mode=nquery&qformat=geojson</span><span lang=EN-US style='color:#1F497D'> to the querystring. The problem is that now the query returns all the features in the layer (the template gets filled correctly though). I use </span><span lang=EN-US style='font-size:9.5pt;font-family:Consolas;color:black;background:white;mso-highlight:white;mso-fareast-language:CS'>INFO_FORMAT=text/html </span><span lang=EN-US style='color:#1F497D'>in the wms getfeatureinfo query.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Any help to get this working would be appreciated, thanks<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Jakub<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p> </o:p></span></p></div></body></html>