PERL Mapscript

Stephen Davies sdc at SDC.COM.AU
Tue Mar 14 20:27:49 PST 2006


I am having my first attempt at using PERL/Mapscript to save map images 
to files and am not getting too far.

I have a map file that works perfectly when used with:

http://server/cgi-bin/mapserv?map=/tmp/q.map&mapext=139.5143351+-34.7459112+139.5278707+-34.7207

I have the following PERL test bed:

#! /usr/bin/perl
#
# args are UID (for mapfile), pic sequence #, image type (extension), 
map extent
#
use strict;
use mapscript;
my $uno = $ARGV[0];
my $seq = $ARGV[1];
my $ext = $ARGV[2];
my $minx = $ARGV[3];
my $miny = $ARGV[4];
my $maxx = $ARGV[5];
my $maxy = $ARGV[6];

#
my $mapfile = "/tmp/$uno.map";
my $map = mapscript::mapObj->new($mapfile);
$map->setExtent($minx,$miny,$maxx,$maxy);
#
my $img = $map->prepareImage();
$img = $map->draw();
my $fname = "/var/www/html/status_images/$uno_$seq.$ext";
print "$fname\n";
$img->save($fname);

Called as:
./genpics q 1 139.5143351 -34.7459112 139.5278707 -34.7207

This generates a blank jpeg file (of some 2800 bytes).

What am I missing?

Cheers and thanks,
Stephen Davies

MapServer version 4.8.0-rc2 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG 
OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=FREETYPE 
SUPPORTS=WMS_SERVER SUPPORTS=WFS_SERVER SUPPORTS=WCS_SERVER 
SUPPORTS=GEOS INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL 
INPUT=SHAPEFILE


-- 
 =======================================================================
This email is for the person(s) identified above, and is confidential to
the sender and the person(s).  No one else is authorised to use or
disseminate this email or its contents.

Stephen Davies Consulting                            Voice: 08-8177 1595
Adelaide, South Australia.                             Fax: 08-8177 0133
Computing & Network solutions.                       Mobile:0403 0405 83



More information about the MapServer-users mailing list