[mapserver-users] JSON template dependencies

Lime, Steve D (MNIT) Steve.Lime at state.mn.us
Thu Apr 17 08:29:35 PDT 2014


Hi Rich: Crap, I had meant to connect with your on this back when you first posted it.

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’”.

There are at least two ways to set the query format. One is to set a default:

WEB
  QUERYFORMAT ‘geojson’
END

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.

Steve


From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Richard Greenwood
Sent: Thursday, April 17, 2014 9:49 AM
To: mapserver
Subject: Re: [mapserver-users] JSON template dependencies

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)"

OUTPUTFORMAT
  NAME "geojson"
  DRIVER "TEMPLATE"
  MIMETYPE 'application/json; subtype=geojson'
  FORMATOPTION "FILE=templates/json.js"
END
this block works (mimetype is removed)

OUTPUTFORMAT
  NAME "geojson"
  DRIVER "TEMPLATE"
  FORMATOPTION "FILE=templates/json.js"
END
I'm still not 100% sure that I have this backed into a corner yet.

So is
   MIMETYPE 'application/json; subtype=geojson'
incorrect? I've tried various other mimetypes to specify JSON output and all fail, however "text/html" works.
I don't understand the relationship between mimetype and a "Malformed template name". Why do I get that error for an invalid mimetype?
Thanks,
Rich



On Thu, Apr 3, 2014 at 8:33 AM, Richard Greenwood <richard.greenwood at gmail.com<mailto:richard.greenwood at gmail.com>> wrote:
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.
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.
Thanks,
Rich

--
Richard Greenwood
richard.greenwood at gmail.com<mailto:richard.greenwood at gmail.com>
www.greenwoodmap.com<http://www.greenwoodmap.com>



--
Richard Greenwood
richard.greenwood at gmail.com<mailto:richard.greenwood at gmail.com>
www.greenwoodmap.com<http://www.greenwoodmap.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140417/e3a63273/attachment-0001.html>


More information about the mapserver-users mailing list