wiki:PerlLayerObj4

layerObj

Adding Dynamic layers in Mapscript 4.0.1 Perl

... However my own code for setting the style on a line layer that I have (dynamically created) does something similar to the following: (where $layer is a layerObj)

my $layerClass = new mapscript::classObj($layer);

  1. ... Set the values inside $layerClass ...

$layerClass->{numstyles} = 1;

If you set TEMPLATE at the layer level

then all shapes in the file are queried, even if they don't belong in any class.

Setting OVERLAYSIZE & etc. via MapScript

(OVERLAYSYMBOL is deprecated)

$style = $class->getStyle(0); # underneath style
$overlay_style = new mapscript::styleObj($class); # new style at index 1
$overlay_style->{symbol} = $overlay_symbol; # a symbol index number
$overlay_style->{size} = $overlay_size; # new symbol size 

Symbolscale Note

The dynamic scaling in mapserver is a bit limited because what we *really* need in many cases is not linear scaling, but *log* scaling of feature line widths. If a feature has size0 = 10 at scale0 = 32000 (your case), it would be nice to have the feature size scale like: size = size0*log(scale0)/(log(scale)


back to PerlMapScript

Last modified 13 years ago Last modified on Jan 29, 2009, 11:23:15 AM