[mapserver-dev] For Consideration: Direct OGR output via WFS

Seth G sethg at geographika.co.uk
Sat Jul 4 12:17:09 PDT 2020

Hi devs,

I've been using MapServer more and more as an export service, providing links to dump out data to a Shapefile (or TAB, Spatialite, etc.) using the WFS protocol with a OUTPUTFORMAT. Creating a MapServer LAYER for this purpose, and configuring an OUTPUTFORMAT provides the functionality of ogr2ogr but via a web-enabled interface directly with MapServer. 

However MapServer loads the data into shapeObjs via the WFS interface and then exports it back out, which seems to cause a big performance hit. The equivalent ogr2ogr export operations can be up to 5-6x faster. 

Are there any insurmountable technical reasons why a layer could not be outputted directly using OGR?

A MapServer LAYER can have lots of additional configuration - FILTERs, native filters, fields limited via METADATA etc. which would likely have to be ignored, or translated into OGR parameters. The following criteria would probably have to apply as a a minimum:

1. Only applicable to layers with CONNECTIONTYPE OGR [1]
2. Only valid for OGR OUTPUTFORMATs [2]

If these are met, perhaps a PROCESSING directive could be added to a layer to enable direct OGR output, something like: "PROCESSING" "OGR_BYPASS=ON" or "OGR_DIRECT_EXPORT=ON". 

At the moment this is just an idea, but I may try and prototype something in Python and get some performance benchmarks. 


[1] https://mapserver.org/input/vector/ogr.html
[2] https://mapserver.org/output/ogr_output.html#outputformat-declarations

twitter: @geographika

More information about the mapserver-dev mailing list