PERL Mapscript
Lowell.Filak
lfilak at MEDINACO.ORG
Wed Mar 15 05:51:27 PST 2006
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,
You should not need prepareImage in this case. map->draw will return the new
imageObj.
If you have additional/continuing problems you may need to include q.map.
Lowell
More information about the MapServer-users
mailing list