[mapserver-users] Add the easy way to get GeoJSON from WFS into documentation

Rahkonen Jukka (Tike) jukka.rahkonen at mmmtike.fi
Mon Sep 15 02:27:42 PDT 2014


Hi,

I suggest to add most parts of the mail from Michael Smith http://lists.osgeo.org/pipermail/mapserver-users/2013-November/075559.html into Mapserver WFS server document http://mapserver.org/ogc/wfs_server.html. It is about an easy way for making Mapserver to serve GeoJSON from WFS. Actually, is there something that prevents GeoJSON output from being one of the internally supported default outputformats without a need to configure it separately in each WFS mapfile? It could be deactivated with "wfs_getfeature_formatlist" if necessary.


This is the mail I refer to:

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


-Jukka Rahkonen-



More information about the mapserver-users mailing list