Peter,

You can use OGR outputformats. Add something like this to your mapfile

OUTPUTFORMAT
  NAME "geojson"
  DRIVER "OGR/GEOJSON"
  MIMETYPE "application/json; subtype=geojson"
  FORMATOPTION "STORAGE=stream"
  FORMATOPTION "FORM=SIMPLE"
END

Add to your LAYER or MAP METADATA, "wfs_getfeature_formatlist” "geojson"

And then in your WFS call add &outputformat=geojson.

This will return geojson directly in the browser, if you need it to download, 
you can change the FORMATOPTION to FORM=ZIP

See http://mapserver.org/output/ogr_output.html for more detail.

Mike

--
Michael Smith
US Army Corps
Remote Sensing GIS/Center

From: Peter Hopfgartner 
<peter.hopfgart...@r3-gis.com<mailto:peter.hopfgart...@r3-gis.com>>
Date: Wednesday, November 13, 2013 at 6:15 AM
To: users mapserver 
<mapserver-users@lists.osgeo.org<mailto:mapserver-users@lists.osgeo.org>>
Subject: [EXTERNAL] [mapserver-users] GeoJSON as WFS output format without 
template
Resent-From: Michael Smith 
<michael.sm...@usace.army.mil<mailto:michael.sm...@usace.army.mil>>

Hi list!

I wanted to have GeoJSON as an output format. Now, if I got the documentation 
right ( http://mapserver.org/it/development/rfc/ms-rfc-62.html, 
http://mapserver.org/it/development/rfc/ms-rfc-36.html), I should prepare a 
template for each layer I'd like to serve as GeoJSON.
Is this right or is there a way that MapServer guesses a reasonable format 
directly from the data, as it does for GML?
Indeed, http://mapserver.org/it/output/template_output.html says "There are 
other, simpler, ways to output some of these formats using MapServer".
Does this simpler way exist for GeoJSON, too?

Regards,

Peter



_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to