Page Properties | ||||||
---|---|---|---|---|---|---|
| ||||||
|
Overview
Is it A few customers have asked if it is possible to retrieve data layers from our a WFS in GeoJSON format?, the answer is Yes. Just follow the steps below.
Step-by-step guide
...
First you need to add the following to your map file.
Code Block |
---|
OUTPUTFORMAT NAME "geojson" DRIVER "OGR/GEOJSON" MIMETYPE "application/json; subtype=geojson" FORMATOPTION "STORAGE=stream" FORMATOPTION "FORM=SIMPLE" END |
For example:
...
Then you need to add the following two options to your LAYER or MAP METADATA
...
"wfs_getfeature_formatlist” "geojson"
...
For example:
...
Now in your WFS call add the following &outputformat=geojson. This will return GeoJSON directly in the browser, if you need it to download, you can change the FORMATOPTION to FORM=ZIP.
For example:
...
More information available here more information please see the MapServer documentation - http://mapserver.org/output/ogr_output.html.