Mapscript - Sorting labels

Ryan, Adam ARyan at CO.LINN.OR.US
Wed Jun 8 18:11:04 EDT 2005


> -----Original Message-----
> From: marc [mailto:gribol at FREE.FR] 
> Sent: Wednesday, June 08, 2005 2:55 PM
> To: MAPSERVER-USERS at LISTS.UMN.EDU
> Subject: [UMN_MAPSERVER-USERS] Mapscript - Sorting labels
> 
> 
> 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.
> 

Hi marc.

Have you tried setting up three scale-dependant (MINSCALE / MAXSCALE
defined) classes within your layer using your filters as EXPRESSION values?

Adam



More information about the mapserver-users mailing list