[Mapserver-users] Problem with Perl Mapscript

Lowell Filak lfilak at medinaco.org
Mon Jul 7 10:45:06 EDT 2003


I don't see anything in the provided code aside from the previously sent
comments and a missing "form" for the html "input".
Is the routine now working or is there another error occurring?
Lowell

The following message was sent by AMC Story <s9646183 at sms.ed.ac.uk> on
Thu, 03 Jul 2003 12:41:52 +0100 (BST).

> Hi everyone,
> 
> Following my question about using JavaScript/MapScript to develop the
standard 
> MapServer interface, I've now decided to try to use both, and have got
the Perl 
> MapScript module working on our apache server.
> 
> My problem is that most of the documentation and examples are for PHP 
> MapScript.  Having only a list of constructors/methods etc for each
object type 
> is helpful to a point, but this doesn't tell me how I should be
putting them 
> together to get something to actually work!  I've been trying to
convert the 
> PHP MapScript by Example HOWTO into perl, using Steve Lime's
mapquakes.pl as a 
> guide.
> 
> My first problem is that perl mapscript doesn't seem to have a direct 
> equivalent of the saveWebImage method.  Is this correct?  In the
absence of 
> such a method, I've been trying to use the saveImage method, but here
I seem to 
> be running into problems.  If you look at the way I've called the
method (see 
> code below), then maybe you could suggest what I'm doing wrong.  
> 
> In the first case (ie. using mapscript::msSaveImage(...)), I get the
error 
> message "Type error in argument 1 of msSaveImage. Expected
_p_gdImagePtr..." 
> when I run the program at the command line.  In the second case, using
$image-
> >saveImage(..), I get the following usage message "Usage:
imageObj_saveImage
> (self,filename,type,transparent,interlace,quality);".  This has
confused me 
> because this isn't the argument list given in the documentation.
> 
> If anyone has some simple, step by step examples of how to build up 
> applications using Perl MapScript I'd be really interested in having a
look.
> 
> Many thanks,
> Ali 
> 
> 
> 
> #!/usr/local/bin/perl -w
> #
> #playing around with mapscript
> #
> 
> #use mapscript;
> use CGI qw(:standard);
> use mapscript;
> 
> $cgi = new CGI;
> 
> $map_file = "/usr/local/apache/local-bin/s9646183/mapscript/quakes.map";
> $image_path = "/usr/local/apache/htdocs/tmp/";
> $image_url = "/tmp/";
> $image_id = $$ . time() . ".png";
> 
> $map = new mapscript::mapObj($map_file);
> $image = $map->prepareImage();
> $layer = $map->getLayerByName('countries');
> $layer->draw($map, $image);
> mapscript::msSaveImage($image, $image_path.$image_id,
$map->{imagetype}, $map->
> {transparent}, $map->{interlace}, $map->{imagequality});
> #$image->saveImage($image, $image_path.$image_id, $mapscript::MS_PNG,
$map->
> {transparent}, $map->{interlace}, $map->{imagequality});
> 
> print $cgi->header();
> print $cgi->start_html(-title=>'Map 1: Perl Mapscript Test');
> 
> print "<p>This is just a test</p>";
> print "<center><input type=\"image\" name=\"map\"
src=\"". $image_url . 
> $image_id ."\"><br>";
> 
> print $cgi->end_html();
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users




More information about the mapserver-users mailing list