[mapserver-dev] WMS and vendor-specific sortBy parameter

Seth G sethg at geographika.co.uk
Fri Feb 21 13:58:10 PST 2020


Hi Jukka,

Agree the beauty of Mapfiles is how easy it is to simply duplicate, change, and you have a whole new set of services. 
The only limitation would be you still have to hard-code sorting on the server, with no flexibility on the client (although I've not tested substitution variables in an ORDER BY in a DATA clause which I think would work if limited to WMS only). 

The MapServer layer interface (via layerinfo->sort_spec) already implements sorting directly in the database for database drivers, which is much faster than loading all data and sorting in MapServer, especially for paged queries. So it may be a case of enabling this to be set by a WMS querystring,

Seth

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

On Wed, Feb 19, 2020, at 9:31 PM, Rahkonen Jukka (MML) wrote:
> Hi,
> 
> Third alternative that I would perhaps use is to duplicate the mapfile, 
> edit as required, and use separate URLs for WMS and WFS. For us that is 
> easy but Geoserver publishes the layers automatically as WMS and WFS 
> (or WMS and WCS) and therefore it must have loads of internal logic for 
> making the layers work for both services.
> 
> I am not sure how to make Geoserver to request data from db with ORDER 
> BY for other type of layers than image mosaics. Probably it is possible 
> with SQL View system that replicates our DATA in mapfile.
> 
> By reading the PR 
> https://github.com/geoserver/geoserver/pull/2462/files I am not sure if 
> Geoserver is trying to send ORDER BY to the database or if is just 
> sorts itself the data that it gets from the data store as usual. 
> Obviously that is the only possibility with a source like shapefile.
> 
> -Jukka Rahkonen-
> 
> 
> -----Alkuperäinen viesti-----
> Lähettäjä: mapserver-dev <mapserver-dev-bounces at lists.osgeo.org> Puolesta Seth G
> Lähetetty: keskiviikko 19. helmikuuta 2020 21.01
> Vastaanottaja: mapserver-dev at lists.osgeo.org
> Aihe: [mapserver-dev] WMS and vendor-specific sortBy parameter
> 
> Hi devs,
> 
> I'm wondering if anyone else sees a need for a sortBy parameter for a 
> MapServer WMS request as a vendor-specific parameter similar to the WMS 
> filter in RFC 118 [1]?
> 
> The use-case for me is as follows:
> 
> - a layer is used for both WMS and WFS. 
> - WFS 2.0 allows user-defined sorting with the SORTBY parameter
> - setting an ORDER BY in the LAYER DATA clause effectively overrides 
> any user sorting
> - without an ORDER BY any WMS requests can return a different image 
> with each request, hence the requirement for a WMS sortBy parameter. 
> Often data needs to be overlain in a specific order e.g. linear surveys 
> by date. 
> 
> The only current alternatives I can think of are:
> 
> - duplicate layer details and use one for WMS with a hard-coded ORDER 
> BY, and one for WFS without
> - if a sortBy parameter is passed in to a layer (via WFS) then override 
> any existing ORDER BY, and use the default if not 
> 
> I'm unsure how each of the various database drivers implement sorting 
> logic. In MSSQL sortBy adds an additional ORDER BY clause to the SQL 
> leading to a SQL syntax error (fix on its way). 
> Any implementation details from other drivers appreciated. 
> 
> This was implemented in GeoServer - see mailing list post [3], check-in 
> [4], and docs [5] Does anyone know of any complications that could 
> arise from implementing this?
> 
> Regards,
> 
> Seth
> 
> [1] https://mapserver.org/development/rfc/ms-rfc-118.html
> [2] https://mapserver.org/ogc/wfs_server.html#support-for-sorting
> [3] 
> http://osgeo-org.1560.x6.nabble.com/New-vendor-parameter-for-WMS-WCS-sortBy-td5327210.html
> [4] https://github.com/geoserver/geoserver/pull/2462/files
> [5] https://docs.geoserver.org/stable/en/user/services/wms/vendor.html
> 
> --
> web:http://geographika.co.uk
> twitter: @geographika
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-dev
>


More information about the mapserver-dev mailing list