[mapserver-users] WFS OUTPUTFORMATs and PROPERTYNAME

Seth G sethg at geographika.co.uk
Mon Jul 2 15:17:30 PDT 2018


Thanks Jukka and Even for the quick replies and suggestions. 
It looks like the issue relates to the MSSQL driver used by the layers I'm testing with - apologies I jumped to the conclusion it wasn't implemented for OUTPUTFORMATs. 

Findings are as follows:

- The output is correct when I use GML output and the MSSQL driver (which I believe defaults to OUTPUTFORMAT=text/xml) - PROPERTYNAME correctly limits which fields are in the GML/XML. 
- For any other format PROPERTYNAME is ignored and all gml_include_items are returned. This includes Shapefile, Spatialite, and CSV (the same SQL is run on the database in both cases)
- Performance on the exports is very slow for Spatialite. I get one of these calls for every feature in the layer: "msMSSQL2008LayerGetShape called for shapeindex = 816457", and it takes 161.799s
- Shapefile also produces the msMSSQL2008LayerGetShape calls but runs in 26.595s
- Adding  &MAXFEATURES=1 works correctly in all cases, but the time to produce the exports is almost identical to a full export

All tests were carried out on the command line on a Windows server. I'm using MS 7.04.

Seth


--
web:http://geographika.co.uk
twitter: @geographika

On Mon, Jul 2, 2018, at 9:25 PM, Even Rouault wrote:
> On lundi 2 juillet 2018 20:55:11 CEST Seth G wrote:
> > Hi all,
> > 
> > A question on WFS GetFeature requests and the OUTPUTFORMAT type.
> > 
> > All fields specified in gml_include_items are returned when creating non-GML
> > outputs such as Shapefile and GeoJSON even when setting the PROPERTYNAME
> > parameter in the request to reduce which fields should be added to the
> > output. The docs at
> > http://mapserver.org/output/ogr_output.html#layer-metadata note you can use
> >  gml_include_items but makes no mention they can't be overridden with
> > PROPERTYNAME .
> > 
> > As OUTPUT format is an extension to WFS
> > (http://mapserver.org/ogc/wfs_server.html#mapserver-wfs-extensions) is this
> > logic by design?
> > 
> > Maybe a note should be added to
> > http://mapserver.org/ogc/wfs_server.html#to-do-items-and-known-limitations
> > ?
> 
> Seth,
> 
> From a quick test, I don't see a difference in behaviour between OGR output 
> and native GML one, based on msautotest wfs_ogr.map
> 
> $ mapserv 
> QUERY_STRING="map=wfs_ogr.map&SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=popplace&OUTPUTFORMAT=CSV&PROPERTYNAME=NAME&MAXFEATURES=1"
> Content-Disposition: attachment; filename=result.csv
> Content-Type: text/csv
> 
> WKT,NAME
> "POINT (2281604.25 340848.9375)","""Tignish"
> 
> 
> $ mapserv 
> QUERY_STRING="map=wfs_ogr.map&SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=popplace&PROPERTYNAME=NAME&MAXFEATURES=1"
> Content-Type: text/xml; subtype=gml/3.1.1; charset=UTF-8
> 
> <?xml version='1.0' encoding="UTF-8" ?>
> <wfs:FeatureCollection
>    xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
>    xmlns:gml="http://www.opengis.net/gml"
>    xmlns:wfs="http://www.opengis.net/wfs"
>    xmlns:ogc="http://www.opengis.net/ogc"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xsi:schemaLocation="http://mapserver.gis.umn.edu/mapserver http://
> localhost/path/to/wfs_simple?
> SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=popplace&OUTPUTFORMAT=text/
> xml;%20subtype=gml/3.1.1  http://www.opengis.net/wfs http://
> schemas.opengis.net/wfs/1.1.0/wfs.xsd">
>       <gml:boundedBy>
>       	<gml:Envelope srsName="EPSG:3978">
>       		<gml:lowerCorner>2281604.250000 340848.937500</gml:lowerCorner>
>       		<gml:upperCorner>2281604.250000 340848.937500</gml:upperCorner>
>       	</gml:Envelope>
>       </gml:boundedBy>
>     <gml:featureMember>
>       <ms:popplace gml:id="popplace.BACMK">
>         <ms:NAME>"Tignish</ms:NAME>
>       </ms:popplace>
>     </gml:featureMember>
> </wfs:FeatureCollection>
> 
> Even
> 
> -- 
> Spatialys - Geospatial professional services
> http://www.spatialys.com


More information about the mapserver-users mailing list