[Geoserver-users] Labelling order

John, generally the order is important (things earlier in the SLD get draw
first), but in your case I suspect that it is the internal ordering of the
points - the cities, villages, etc. - that are mixed up and thus your
labeling order is mixed up, too.

It looks like you've already tried to use a filter to separate cities from
villages using different rules (and then label them accordingly). Do you
know why you separated your rules into a single rule in 2 different
<FeatureTypeStyle>s rather than 2 rules in the same FeatureTypeStyle? I'm
not sure if this might be affecting your results, but it's worth trying (or at
least, that's how I tend to write my SLDs).

As I understand it, as features get read, every rule and symbolized that
applies to a feature gets used, so if the internal ordering of the data
is mixed, the output is as well. If the 2-rules / same-FeatureTypeStyle
still doesn't work, I'd try writing 2 different SLD styles, one for cities
and one for villages, and make two sequential WMS/WFS calls: one drawing
and labeling only the villages (requesting the layer drawn with the
villages-only SLD), followed by one for the cities (same layer but with the
cities-only SLD). A little more cumbersome, but it should guarantee order
separation between your different kind of features.

- Dave Richardson
  Dept. of Envi. Sci. & The Scholars' Lab, Uva Library
  University of Virginia

From: "John Fannon" <john.fannon@anonymised.com>
Subject: [Geoserver-users] Labelling order

I've created a style to symbolise some openstreetmap place names which
currently has 3 rules depending on whether the place is a city, town or
village etc. There are also some scale dependencies in there too.

This works ok except that in the openlayers preview, when you get down
below 1:250k and all the labels are displaying, some village labels seem
to be taking preference over city labels. What I want is for cities to
be labelled first, followed by towns, followed by villages.

I've messed about with the order of the <FeatureTypeStyle> elements, but
this doesn't seem to make any difference to the labelling order. Anyone
got any bright ideas as to how to force the city labels to take
precedence?

I'd be grateful for any input. My SLD is below for reference.
Cheers
John