[mapserver-users] Control order of drawing for a layer

Rahkonen Jukka jukka.rahkonen at mmmtike.fi
Tue Jun 4 00:10:18 PDT 2013


Hi,

If you want to do is fast, try sortshp and sort your shapefile by your attribute http://mapserver.org/utilities/sortshp.html.  It should work well if one attribute is enough for sorting and in some cases it may be possible to get a usable result by sorting the sorted shapefile again by another attribute.

More flexible would be to import the shapefile into database, for example Spatialite, create index the attributes needed for sorting and use ORDER BY in the LAYER DATA.  It may also be possible to connect your shapefile directly through OGR and use SQL in the same way in the DATA line somehow like
CONNECTIONTYPE OGR
CONNECTION "full/path/to/test.shp"
DATA "SELECT * from test ORDER BY attribute"

This is probably the slowest alternative. I have not a tested example available and I do not know if this works really.

-Jukka Rahkonen-

Jesper Kempe wrote:

Hi

I have a shapefile with quite many points in. Several of the points are very close or even on the same locations. Every point has some attributes and some of the points are more important than others (based on a attributes value).
What I am trying to do, and not succeding in, is to have points with attribute x=Y drawn ontop of everything else.

Now I have a layer definition with the classes I want to have "in the bottom of the image" first and the most important last. Each with an expression matching a certain attribute. But it looks like the only order that matters is the order in which the points in the shapefile are listed.

>From the mapfile:

                TILEITEM "location"
                TILEINDEX "shapefile.idx.shp"

                SIZEUNITS meters

                CLASSITEM "GEOM_TYPE"

                CLASS
                    NAME "clouds"
                    EXPRESSION "clou"
                    COLOR 186 186 186
                    SYMBOL "mapinfo-sym-32"
                    SIZE 1200
                END

                CLASS
                    NAME "no_d"
                    EXPRESSION "no_d"
                    COLOR 0 0 0
                    SYMBOL "mapinfo-sym-32"
                    SIZE 1200
                END

                CLASS
                    NAME "subs"
                    EXPRESSION "subs"
                    COLOR 255 255 0
                    SYMBOL "mapinfo-sym-32"
                    SIZE 1200
                END

                CLASS
                    NAME "surfs"
                    EXPRESSION "surf"
                    COLOR 246 112 38
                    SYMBOL "mapinfo-sym-32"
                    SIZE 1200
                END


Anyone has a tip on how I can get the desired effect?

//Jesper


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20130604/82b26b9d/attachment.html>


More information about the mapserver-users mailing list