[mapserver-users] [EXTERNAL] GeoJSON as WFS output format without template

Smith, Michael ERDC-RDE-CRREL-NH Michael.Smith at erdc.dren.mil
Wed Nov 13 03:49:15 PST 2013


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.hopfgartner at r3-gis.com<mailto:peter.hopfgartner at r3-gis.com>>
Date: Wednesday, November 13, 2013 at 6:15 AM
To: users mapserver <mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>>
Subject: [EXTERNAL] [mapserver-users] GeoJSON as WFS output format without template
Resent-From: Michael Smith <michael.smith at usace.army.mil<mailto:michael.smith at 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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20131113/114afd4a/attachment.html>


More information about the mapserver-users mailing list