[Mapserver-users] altering $layer->{symbolscale} before draw()

Nikolai Vladychevski niko at isl.net.mx
Fri Feb 27 10:05:10 EST 2004


Hi, 

I have a perl script that uses mapscript to create a map with many layers. I 
want to dynamicaly alter SYMBOLSCALE of the layer depending on the scale of 
the map, because when user zooms too much, the symbol is too big. I can not 
lower SYMBOLSCALE and leave it fixed in mapfile becasue when user is 
browsing at high scales, the symbols is very small, almost invisible. 

So I have this code, but it isn't giving expected results, nothing happends:
sub drawLayers {
   my $m=shift;  #map
   my $i=shift;  #image 

for ($lidx=0;$lidx<$m->{numlayers};$lidx++) {
       $l=$m->getLayer($lidx);
       if ($m->{scale}<32000 && ($l->{name} eq "emplazamientos")) {
           $l->{symbolscale}=320;  #<- this doesn't make any difference
       }
       $l->draw($m,$i);
   } 

here are some lines in mapfile:
 LAYER
       NAME emplazamientos
       DATA emplazamientos.shp
       CLASSITEM 'ID'
       LABELITEM 'ID'
       SYMBOLSCALE 32000
       CLASS
           NAME 'emplazamientosactivos'
           COLOR 0 0 255
           SYMBOL 'emplazamiento'
           SIZE 10
           TEMPLATE "emplazamiento.html"
       END
       .....
  SYMBOL
       NAME "emplazamiento"
       TYPE TRUETYPE
       FONT transmision
       FILLED true
       ANTIALIAS true
       CHARACTER "F"
  END
...... 

How do I have to change the {symbolscale} variable in order to achieve 
changes in the display, as I do it above, setting it to different values 
doesn't make any difference 

Thanks in advance
Nikolai



More information about the mapserver-users mailing list