[Mapserver-users] perl mapscript - progress...

Vinko Vrsalovic vinko at cprsig.cl
Mon Mar 3 20:22:42 PST 2003


On Mon, Mar 03, 2003 at 07:30:04PM -0800, Junkmail Box wrote:
 
> > The defalt status for a layer is OFF :-)
> > $layer->{'status'} = $mapscript::MS_ON;
> 
> Good thinking. Setting the status still doesn't make any points appear,
> however. Is the rest of that "declare a point, set its coords, and draw
> it" syntax correct?
 
See below. Declare a point, set coords, set how it will be displayed,
and draw it.
 
> > The point coordinates are supposed to be consistent to the rest of
> > the data and the extent set in mapObj or the mapfile.
> 
> How do you mean? The extent I have in arcata.map is:
> EXTENT 407375  4522866  410627 4526910
> So I changed the test script to these coords:
> $point->{'x'} = 408500;
> $point->{'y'} = 4525000;
> but still nothing is displayed.
 
See below :)
 
> > To debug this type of thing i use the mapObj->save() method, it's really
> > useful. Dunno if perl mapscript has it, though.
> 
> Hey, now that's spiffy. This appears to be the relevant paragraph. Do you
> notice anything missing?
> 
>   LAYER
>     NAME "points"
>     SIZEUNITS PIXELS
>     STATUS ON
>     TOLERANCE 3
>     TOLERANCEUNITS PIXELS
>     TYPE POINT
>     UNITS METERS
>   END
> 
 
Doh! How did I overlook this... You're missing a class declaration. You
need to declare a class with the color, symbol and size you want the point
drawn. 

$class = new classObj($layer) //Use Perl syntax, of course :)
$class->{'symbol'} = 0;
$class->{'color'} = $map->addColor(R,G,B);
$class->{'size'} = 2;

This syntax changed for 3.7 with the new styleObj. Keep that in mind if
you'll move on to 3.7.

-- 
Vinko Vrsalovic <el[|- at -|]vinko.cl>
http://www.cprsig.cl



More information about the MapServer-users mailing list