Thanks to both of you for your replies. The main reason to use "application/json" was to avoid making changes to a JavaScript client that remains GeoServer/MapServer neutral.
The hint to look at the outputFormats in http://localhost/mapserver/?&version=1.1.0&service=WFS&request=getcapabilities was useful. It appears a client can use either the OUTPUTFORMAT NAME or MIMETYPE to send in the OUTPUTFORMAT parameter of a querystring. <ows:Parameter name="outputFormat"> <ows:Value>text/xml; subtype=gml/3.1.1</ows:Value> <ows:Value>shapezip</ows:Value> <ows:Value>dbfzip</ows:Value> <ows:Value>spatialite</ows:Value> <ows:Value>application/json; subtype=geojson</ows:Value> </ows:Parameter> To resolve the issue I could simply remove the subtype from the mime-type (which was incorrect anyway according to https://sgillies.net/2014/05/22/the-geojson-media-type.html). The final working OUTPUTFORMAT is: OUTPUTFORMAT NAME "application/json" DRIVER "OGR/GEOJSON" MIMETYPE "application/json" FORMATOPTION "FORM=SIMPLE" FORMATOPTION "STORAGE=memory" END WEB METADATA .. "wfs_getfeature_formatlist" "gml,geojson,shapezip,dbfzip,spatialite,application/json" .. -- web:http://geographika.co.uk twitter: @geographika On Thu, Dec 20, 2018, at 9:14 AM, Rahkonen Jukka (MML) wrote: > Hi, > > We use outputformat as follows. The mimetype is what is written to > GetCapabilities, in our case > <GetFeatureInfo><Format>application/json</Format> > OGC service clients are supposed to use that as the format name. The > problem that you have by using "application/json" as a name may be a bug > but you can avoid it by using some other name. If you want to support > both "application/json" and "application/json; subtype=geojson" you > must write two outputformats. > > OUTPUTFORMAT > NAME "geojson" > MIMETYPE "application/json" > DRIVER "TEMPLATE" > FORMATOPTION " geojson_template.js" > END > > -Jukka Rahkonen- > > -----Alkuperäinen viesti----- > Lähettäjä: mapserver-users > [mailto:[email protected]] Puolesta Seth G > Lähetetty: 20. joulukuuta 2018 0:28 > Vastaanottaja: [email protected] > Aihe: [mapserver-users] WFS OUTPUTFORMAT and application/json > > Hi list, > > Has anyone run into the following issue with using "application/json" in > an OUTPUTFORMAT NAME as follows? > > OUTPUTFORMAT > NAME "application/json" > DRIVER "OGR/GEOJSON" > MIMETYPE "application/json; subtype=geojson" > FORMATOPTION "FORM=SIMPLE" > FORMATOPTION "STORAGE=memory" > END > > Then a request such as below: > > http://localhost/mapserver/?&SERVICE=WFS&REQUEST=GetFeature&VERSION=1.1.0&OUTPUTFORMAT=application/json&TYPENAME=layer&SRSNAME=EPSG:3857 > > Causes the following error: > > msWFSGetFeature(): WFS server error. OUTPUTFORMAT 'application/json' > does not have IMAGEMODE FEATURE, and is not permitted for WFS output. > > Adding a IMAGEMODE FEATURE (or RGBA) doesn't resolve the issue. > I thought it may have been an issue with the slash in the NAME, but this > works in other cases. Changing NAME to "geojson" also works fine, but > I'm wondering why this occurs. GeoServer and TinyOWS both use > "application/json" so it would be good if it worked for MapServer also. > > > Seth > > > -- > web:http://geographika.co.uk > twitter: @geographika > _______________________________________________ > mapserver-users mailing list > [email protected] > https://lists.osgeo.org/mailman/listinfo/mapserver-users _______________________________________________ mapserver-users mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/mapserver-users
