<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=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
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;}
span.hoenzb
        {mso-style-name:hoenzb;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi Rich: Crap, I had meant to connect with your on this back when you first posted it.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I don’t think this is related to the MIMETYPE. I use an output format very similar to the you do. I think what’s happening is that MapServer doesn’t know to
 use the geojson output format and falls back to a template as defined in a layer in your mapfile. I’m guessing that at least one layer in your mapfile has “TEMPLATE ‘dummy’”.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">There are at least two ways to set the query format. One is to set a default:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">WEB<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">  QUERYFORMAT ‘geojson’<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">END<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The other is dynamically via your service call or using a cgi parameter. What I’d recommend is setting a default in the web object and see if that fixes things.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Steve<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> mapserver-users-bounces@lists.osgeo.org [mailto:mapserver-users-bounces@lists.osgeo.org]
<b>On Behalf Of </b>Richard Greenwood<br>
<b>Sent:</b> Thursday, April 17, 2014 9:49 AM<br>
<b>To:</b> mapserver<br>
<b>Subject:</b> Re: [mapserver-users] JSON template dependencies<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">I've been struggling with the JSON template errors described in my April 3 email below. Initially I was blaming it on different computers. Now I think it is related to the MIMETYPE in the OUTPUTFORMAT block.
 This block fails with "Malformed template name (dummy)"<br>
<br>
OUTPUTFORMAT<br>
  NAME "geojson"<br>
  DRIVER "TEMPLATE"<br>
  MIMETYPE 'application/json; subtype=geojson'<br>
  FORMATOPTION "FILE=templates/json.js"<br>
END<o:p></o:p></p>
</div>
<p class="MsoNormal">this block works (mimetype is removed)<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
OUTPUTFORMAT<br>
  NAME "geojson"<br>
  DRIVER "TEMPLATE"<br>
  FORMATOPTION "FILE=templates/json.js"<br>
END<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I'm still not 100% sure that I have this backed into a corner yet.
<br>
<br>
So is<br>
   MIMETYPE 'application/json; subtype=geojson'<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">incorrect? I've tried various other mimetypes to specify JSON output and all fail, however "text/html" works.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">I don't understand the relationship between mimetype and a "Malformed template name". Why do I get that error for an invalid mimetype?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks,<br>
Rich<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Thu, Apr 3, 2014 at 8:33 AM, Richard Greenwood <<a href="mailto:richard.greenwood@gmail.com" target="_blank">richard.greenwood@gmail.com</a>> wrote:<o:p></o:p></p>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">I have two very similar computers. On one JSON templates work, the other not. The not-working one displays "Malformed template name (dummy)" where "dummy" is a non-existent file and the non-working version seems
 to ignore the OUTPUTFORMAT block. For example I can put invalid parameters in the block and they don't throw errors whereas on my working computer they do.<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">So I'm wondering if there are any dependencies at either compile or run time that I'm missing. My working computer is Fedora with MapServer installed from a repo, my non-working computer is Amazon Linux (at
 Redhat derivative) with MapServer 6.0 and 6.2 built from source. <o:p></o:p></p>
</div>
<p class="MsoNormal">Thanks,<br>
Rich<span class="hoenzb"><span style="color:#888888"><o:p></o:p></span></span></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="color:#888888"><br>
-- <br>
Richard Greenwood<br>
<a href="mailto:richard.greenwood@gmail.com" target="_blank">richard.greenwood@gmail.com</a><br>
<a href="http://www.greenwoodmap.com" target="_blank">www.greenwoodmap.com</a> </span>
<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <br>
Richard Greenwood<br>
<a href="mailto:richard.greenwood@gmail.com">richard.greenwood@gmail.com</a><br>
<a href="http://www.greenwoodmap.com">www.greenwoodmap.com</a> <o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>