[Mapserver-users] Problems with PerlMapscript 3.7 Syntax

Sean Gillies sgillies at frii.com
Thu May 1 13:47:26 EDT 2003


Babak,

The function you're looking for is save(), not saveImage().

To find out what functions are current in MapScript, you need to
look in the mapscript.i file.  The documentation is far behind
development.

To find all symbols in a package, do something like what's
illustrated on page 281 of Programming Perl, 2nd edition:

foreach $symname (sort keys %main::) {
	...
}

Hope this helps,
Sean

On Thursday, May 1, 2003, at 08:34  AM, Babak Toloue Tehrani wrote:

> Hello,
>
> I have still problems with perlmapscript 3.7. The demo below with the
> syntax of perlmapscript 3.6 is working very fine on my system. shp2img
> is also working for the mapfile below.
>> From the WIKI MigrationGuide I Take the syntax for saveImage():
>
> $img->saveImage('test37.png');
>
> and get following output:
>
> Can't locate auto/mapscript/imageObj/saveImage.al in @INC (@INC
> contains: /usr/lib/perl5/5.8.0/i586-linux-thread-multi
> /usr/lib/perl5/5.8.0
> /usr/lib/perl5/site_perl/5.8.0/i586-linux-thread-multi
> /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl .) at test37.pl
> line 7
>
> Then I looked for the string saveImage in the mapscript.pm module and
> found the function msSaveImage who brings me following output:
>
> Usage: msSaveImage(map,img,filename); at test37.pl line 7.
>
> I tried: $map->msSaveImage($map,$img,'test37');
>
> and got same errormessage as before. Then I tried to set the set the
> ImageType with:
>
> map->setImageType("png") or die('Unable to setImageType.');
>
> and see that it failed. Here the script and the mapfile:
>
> (Does someone now a tool to extract from a perl Module (mapscript.pm) a
> list of all Classes/Objects, Members and Methods?)
>
> Thanks a lot,
>
> Babak
>
> ======================================================================= 
> ===
> #!/usr/bin/perl -w
> use mapscript;
> use strict;
>
> my $map = new mapscript::mapObj("data/demo37.map") or die('Unable to
> OPEN mapfile.');
> $map->setImageType("png") or die('Unable to setImageType.');
> my $img = $map->draw() or die('Unable to DRAW mapfile.');
> $map->msSaveImage($map,$img,'test37');
> $img->free();
> ----------------------------------------------------------------------- 
> ---
> NAME DEMO37
> STATUS ON
> SIZE 600 450
> EXTENT 5.3 55.5 15.5 46.9
> UNITS METERS
> SHAPEPATH "data"
> IMAGECOLOR 255 255 255
>
> OUTPUTFORMAT
>   NAME png
>   DRIVER "GD/PNG"
>   MIMETYPE "image/png"
>   IMAGEMODE PC256
>   EXTENSION "png"
> END
>
> LAYER
>   NAME TESTLAYER
>   TYPE POLYGON
>   STATUS DEFAULT
>   DATA lnd01dd.shp
>   CLASS
>       NAME TESTCLASS
>       SYMBOL 0
>       COLOR 195 195 195
>       OUTLINECOLOR 102 102 102
>   END
> END
> END
>
>
--
Sean Gillies
sgillies at frii dot com
http://www.frii.com/~sgillies




More information about the mapserver-users mailing list