<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>Peter,</div>
<div><br>
</div>
<div>You can use OGR outputformats. Add something like this to your mapfile</div>
<div><br>
</div>
<div>
<div>OUTPUTFORMAT</div>
<div> NAME "geojson"</div>
<div> DRIVER "OGR/GEOJSON"</div>
<div> MIMETYPE "application/json; subtype=geojson"</div>
<div> FORMATOPTION "STORAGE=stream"</div>
<div> FORMATOPTION "FORM=SIMPLE"</div>
<div>END</div>
</div>
<div><br>
</div>
<div>Add to your LAYER or MAP METADATA, "wfs_getfeature_formatlist” "geojson"</div>
<div><br>
</div>
<div>And then in your WFS call add &outputformat=geojson.</div>
<div><br>
</div>
<div>This will return geojson directly in the browser, if you need it to download, you can change the FORMATOPTION to FORM=ZIP</div>
<div><br>
</div>
<div>See <a href="http://mapserver.org/output/ogr_output.html">http://mapserver.org/output/ogr_output.html</a> for more detail.</div>
<div><br>
</div>
<div>Mike</div>
<div><br>
</div>
<div>
<div>
<div>
<div>-- </div>
<div>Michael Smith</div>
</div>
<div>US Army Corps</div>
<div>Remote Sensing GIS/Center</div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Peter Hopfgartner <<a href="mailto:peter.hopfgartner@r3-gis.com">peter.hopfgartner@r3-gis.com</a>><br>
<span style="font-weight:bold">Date: </span>Wednesday, November 13, 2013 at 6:15 AM<br>
<span style="font-weight:bold">To: </span>users mapserver <<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a>><br>
<span style="font-weight:bold">Subject: </span>[EXTERNAL] [mapserver-users] GeoJSON as WFS output format without template<br>
<span style="font-weight:bold">Resent-From: </span>Michael Smith <<a href="mailto:michael.smith@usace.army.mil">michael.smith@usace.army.mil</a>><br>
</div>
<div><br>
</div>
<div>
<div text="#000000" bgcolor="#FFFFFF">Hi list!<br>
<br>
I wanted to have GeoJSON as an output format. Now, if I got the documentation right (
<a href="http://mapserver.org/it/development/rfc/ms-rfc-62.html">http://mapserver.org/it/development/rfc/ms-rfc-62.html</a>,
<a href="http://mapserver.org/it/development/rfc/ms-rfc-36.html">http://mapserver.org/it/development/rfc/ms-rfc-36.html</a>), I should prepare a template for each layer I'd like to serve as GeoJSON.<br>
Is this right or is there a way that MapServer guesses a reasonable format directly from the data, as it does for GML?<br>
Indeed, <a href="http://mapserver.org/it/output/template_output.html">http://mapserver.org/it/output/template_output.html</a> says "There are other, simpler, ways to output some of these formats using MapServer".<br>
Does this simpler way exist for GeoJSON, too?<br>
<br>
Regards,<br>
<br>
Peter<br>
<br>
<br>
<br>
</div>
</div>
</span>
</body>
</html>