[mapserver-dev] incorrect layer drawing order issue

Lime, Steve D (MNIT) Steve.Lime at state.mn.us
Mon Nov 10 08:44:03 PST 2014

I would love to see some sort of sorting capability but at least for shapefiles I've always relied on a presort (using sortshp utility) for performance reasons. I think if something more configurable was needed then one would simply need to OGR access as a wrapper for shapefiles. Maybe the various driver owners could weigh in regarding the SORTBY option.


From: mapserver-dev-bounces at lists.osgeo.org [mapserver-dev-bounces at lists.osgeo.org] on behalf of Tamas Szekeres [szekerest at gmail.com]
Sent: Sunday, November 09, 2014 3:21 PM
To: geographika at gmail.com
Cc: mapserver-dev at lists.osgeo.org
Subject: Re: [mapserver-dev] incorrect layer drawing order issue

Yes that would be the simplest approach in short term.
But I think it would also be reasonable to get it configurable for all supported drivers, through mapfile and mapscript.

Best regards,


2014-11-09 20:49 GMT+01:00 geographika <geographika at gmail.com<mailto:geographika at gmail.com>>:
Would a SORTBY clause be added as a keyword in the DATA statement?
E.g. DATA "ogr_geometry from rivers USING UNIQUE ogr_fid USING SRID=4326 USING SORTBY my_sort_fieldname"

On 07/11/2014 12:49, Tamas Szekeres wrote:
We could also extend the DATA section with a SORTBY clause for the mssql driver.
Adding this feature to MSSQL (as per RFC 105) would anyway be fairly easy.


2014-11-07 11:24 GMT+01:00 geographika <geographika at gmail.com<mailto:geographika at gmail.com>>:
Hi list,

I have come across an issue that is critical to the project I am working on and wondered if it applies to all database drivers or just the SQL Server 2008 one.

I have logged the issue on GitHub at: https://github.com/mapserver/mapserver/issues/5008

I will try some tests over the weekend to see if the Postgres driver works the same way, but there seems to be no way of guaranteeing feature display order - even if all documentation suggests it can be achieved in a database layer using "ORDER BY"
Whilst for a low number of records the order seems ordered, with 150+ features I get different images returned each time by my WMS service. No use of clustered indexes, partition statements etc. can get around this as SQL result sets can only be guaranteed with an ORDER BY in the outermost statement.

I note that in http://mapserver.org/fr/development/rfc/ms-rfc-105.html there is a new function msLayerBuildSQLOrderBy() that allows sorting to be done outside of the layer's DATA statement for WFS requests with a SORTBY parameter. Maybe this could also be used by a new LAYER "SORT" config keyword?

I see the above is only implemented for a few drivers. The client would be willing to fund adding this to the SQL Server driver if there are any core devs interested in doing this.



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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20141110/d63b192d/attachment.html>

More information about the mapserver-dev mailing list