PERL Mapscript

Lowell.Filak lfilak at MEDINACO.ORG
Fri Mar 17 16:46:39 EST 2006


Stephen Davies writes: 

> One step forward; one step back;-( 
> 
> I am now getting a non-blank output but it only contains those layers 
> which do not use data from the postGIS database. 
> 
> Is there something extra that needs to be done in PERL/Mapscript  to 
> turn on database access? If so, where is it documented? 
> 
> Cheers and thanks,
> Stephen Davies 
> 
> On Thursday 16 March 2006 00:21, Lowell.Filak wrote:
>> Stephen Davies writes:
>> > Sorry; a mistake in my posting.
>> >
>> > The actual invocation of the script was:
>> > ./genpics q 1 jpg 139.5143351 -34.7459112 139.5278707 -34.7207
>> >
>> > The problem remains.
>> >
>> > Cheers and thanks
>> > Stephen
>> >
>> > On Wednesday 15 March 2006 17:01, Manfred Meier wrote:
>> >>  > ./genpics q 1 139.5143351 -34.7459112 139.5278707 -34.7207
>> >>
>> >> Is there a parameter missing before "139.5143351"? minx is ARGV[3]
>> >> in your program.
>> >>
>> >> Hope that helps
>> >> Manfred
>> >>
>> >> Stephen Davies schrieb:
>> >> > 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

Stephen, 

When you compile the cgi the db access is there for mapscript also.
If the cgi is working then mapscript should (so should shp2img).
Also, in your later message it appears that image layers are also not 
drawing.?
However, the copyright layer at the bottom of the list "is" drawing.
You could turn on logging - "$ENV{MS_ERRORFILE} = 
"../html/tmp/mapserver.log";" to see if that produces any indicators.
My experience has been that "if" any error occurs while rendering "any" 
layers in the mapfile the entire process will stop. This means that the 
copyright layer would never draw either.
Is the date and time on "mapscript.*" under /usr/lib more recent than 
"mapserv"? 

Lowell



More information about the mapserver-users mailing list