I am relearning MapScript after years of innocence. I have a fairly simple script like so (also at http://pastebin.com/7rehitjH). The image is created, but is empty, plain white. There is some silliness on my part, something obvious I am overlooking or doing wrong, and I need someone to point it to me. Needless to say, the same map draws fine via MapServer CGI --
my $map = new mapscript::mapObj(); warn "New mapObj() error: $mapscript::ms_error->{message}\n" unless $map; $map->{status} = $mapscript::MS_ON; # STATUS ON $map->{units} = $mapscript::MS_DD; # UNITS DD $map->setImageType('png'); # IMAGETYPE PNG $map->{imagecolor} = new mapscript::colorObj(255, 255, 255); # IMAGECOLOR 255 255 255 $map->setSize(1000, 600); # SIZE 1000 600 $map->setExtent( -180, -90, 180, 90 ); # EXTENT -180 -90 180 90 $map->selectOutputFormat( 'png' ); # Choose active output format $map->setProjection( "proj=latlong" ); # PROJECTION # "proj=latlong" # END my $outputFormatObj = new mapscript::outputFormatObj('GD/PNG'); # DRIVER "GD/PNG" $outputFormatObj->setExtension('png'); # EXTENSION "png" $outputFormatObj->setMimetype('image/png'); # MIMETYPE "image/png" $outputFormatObj->{imagemode} = $mapscript::MS_IMAGEMODE_RGB; # IMAGEMODE RGB | PC256 $map->setOutputFormat( $outputFormatObj ); my $layerObj = new mapscript::layerObj($map); $layerObj->setConnectionType($mapscript::MS_POSTGIS, ''); $layerObj->{connection} = "host=127.0.0.1 port=5432 dbname=$db user=$dbuser password=$pwd"; $layerObj->{data} = 'the_geom FROM table USING UNIQUE gid'; my $classObj = new mapscript::classObj($layerObj); $classObj->{name} = 'foo'; my $styleObj = new mapscript::styleObj($classObj); $styleObj->{color} = new mapscript::colorObj( 132, 132, 132); $styleObj->{outlinecolor} = new mapscript::colorObj(0, 0, 0); # create an image for drawing. my $img = $map->draw(); warn "prepareImage() error: $mapscript::ms_error->{message}\n" unless $img; $img->save("$tmp_dir/$image_name");_______________________________________________ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users