Mapscript - Sorting labels

marc gribol at FREE.FR
Wed Jun 8 17:55:16 EDT 2005


Hi,

I have a shapefile (points) which contains cities names. For each town, a
field contains the population number.
I would like to renderer my map with cities names. I use Mapserver's stuff
to avoid name collisions. I use the population field to do some filtering.
I use PHP-Mapscript.

Here is a pseudo algorithm:

IF map_extent > 180 THEN render shapes with population > 5000k
ELSE IF map_extent > 90 THEN render shapes with population > 2500k
ELSE IF map_extent > 45 THEN render shapes with population > 1000k
...

When the current map extent fits the first condition, it's fine.
But for the others conditions, all matching shapes are rendered but without
any sort between them.

For the second condition, I would like to render first the shapes with pop
> 5000k, then next the shapes with 5000k > pop > 2500k.

If I use 2 classes in a same layer, it is not working. I can have names of
towns which are in the range [2500k-5000k] and no name in the range > 5000k
(I suppose that there are towns with pop > 5000k, but the Mapserver
collision treatment filters them).
So I cannot guarantee that cities with pop > 5000k are first displayed. And
next, cities with population in the range [2500k-5000k].

I get the same issue with 2 layers and a FILTER attribute on each layer.

Any suggestion to help me ?
Thanks.



More information about the mapserver-users mailing list