SIZEUNITS in Perl Mapscript

Agneta Schick schick at SDAC.HANNOVER.BGR.DE
Thu Feb 17 02:30:46 EST 2005


> > > > Problem: symbol size doesn't scale
> > > > Software: MapServer version 4.2.3, Perl MapScript
> > > >
> > > > Is my understanding of SIZEUNITS correct?:
> > > >         I can define SIZEUNITS to kilometers, define a symbol 'circle'
> > > >         and by setting the symbol size to my radius (in kilometers),
> > > >         this symbol will scale to my zoom depth?
> > > >
> > > > My symbol always has the same pixel size as if SIZEUNITS uses the
> default
> > > > PIXELS.
> > > >
> > > > I checked the user group mails but found no clue, except that
> other users
> > > > also had problems.
> > > >
> > > > The layer in question is
> > > > LAYER
> > > >    NAME 'percept'
> > > >    TYPE point
> > > >    STATUS on
> > > >    PROJECTION
> > > >          "proj=latlong"
> > > >          "datum=WGS84"
> > > >    END
> > > >    SIZEUNITS kilometers
> > > >    CLASS
> > > >     STYLE
> > > >      SIZE 1
> > > >      SYMBOL 'circle'
> > > >      OUTLINECOLOR 0 0 240
> > > >     END
> > > >    END
> > > > END
> > > >
> > > > and the perl snippet:
> > > >                 $layer = $map->getLayerByName('percept');
> > > >                 $class = $layer->getClass(0);
> > > >                 $style = $class->getStyle(0);
> > > >                 $style->{size} = int($radius);
> > > >                 $point = new mapscript::pointObj();
> > > >                 $point->{x} = $lon;
> > > >                 $point->{y} = $lat;
> > > >                 $point->draw($map, $layer, $img, 0,0);
> > > >
> > > > I appreciate any help in this matter since 'racking my brain'
> doesn't help
> > > > me at all!
> > >
> > > Agneta,
> > >
> > > If I'm understanding things correctly, sizeunits effects the 'class'
> > > size and not the 'style' size.
> > >
> > > Lowell
> >
> > Can you change the class size in Perl Mapscript?
> > It's not documented and I get an error when I try:
> > "Can't locate auto/mapscript/classObj/swig_size_s.al in @INC"
> > I know sizeunits effects a class object but  I thought I could change
> the size
> > by using a style object.
>
> I may have misspoke, have you tried setting the layer symbolscale? You
> may also need minsize & maxsize.
>
> Lowell

Ok, I discarded STYLE, used layer->{symbolscale} to set the radius, but to no
affect. I even set class->{minscale} and class->{maxscale} to radius, but
it all results in plotting a cicle with 1 pixel.
Has anyone successfully used sizeunits with perl mapscript?

Agneta



More information about the mapserver-users mailing list