[Mapserver-users] Problems with PerlMapscript 3.7 Syntax
Babak Toloue Tehrani
babak.tehrani at geosysnet.de
Thu May 1 11:34:58 PDT 2003
Thanks Sean and Lowell,
#!/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");
my $img = $map->draw() or die('Unable to DRAW mapfile.');
$img->save('test37');
$img->free();
This works!!!!
The mistake was to write ...or die('Unable to setImageType.'); behind
the setImageType!!?? This works also for swf, but then the $img->free()
give me a memoryaccesserror when I use setImageType("swf") to specify
the outputformat. I don't get the error when I specify the outputpormat
in the mapfile. The swf file is produced even though the error.
Cheers
Am Don, 2003-05-01 um 20.07 schrieb Lowell Filak:
> There are a few things here that may be causing the exit during the setting of the image type, ie. "use strict".
> Have you already tried tuirning on the debugging to see if you receive a better message of what is occuring?
> Lowell F.
>
> The following message was sent by Babak Toloue Tehrani <babak.tehrani at geosysnet.de> on 01 May 2003 16:34:07 +0200.
>
> > 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
> >
> > --
> > Babak Toloue Tehrani <babak.tehrani at geosysnet.de>
> >
> > _______________________________________________
> > Mapserver-users mailing list
> > Mapserver-users at lists.gis.umn.edu
> > http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
--
Babak Toloue Tehrani <babak.tehrani at geosysnet.de>
More information about the MapServer-users
mailing list