Perl API method setProjection doesn ’t work.

SUBSCRIBE MAPSERVER-USERS Cave caveeagle at POCHTAMT.RU
Wed Apr 13 03:45:50 EDT 2005


Sorry, I have some problems with perl library for map-script.

Here if I use any projection except “lonlat”, the output file contains an
empty image. If this projection is  set in a cgi-script, everything is
displayed correctly.

If  I comment this string:
$map->setProjection('proj=eqc,lat_ts=50,lon_0=80')
The graphic file appears again, but in the standard lonlat projection. In
fact, my problem is that I need to  set the projection in perl, instead of
map-file.

###############################################################

Example of perl script:

#!/usr/local/bin/perl -w

use mapscript;
$ENV{MS_ERRORFILE} = "mapError.log";  ### mapscript error log
my $mapname = "/www/allsatwms/allsat.map";  # map-file name

my $map = new mapscript::mapObj($mapname);
if(!$map){warn "New mapObj() error: $mapscript::ms_error->{message}\n";}

$map->{extent}->{minx} = 50;
$map->{extent}->{maxx} = 100;
$map->{extent}->{miny} = 30;
$map->{extent}->{maxy} = 70;
$map->{width} = 1280;
$map->{height} = 1024;

$map->setProjection('proj=eqc,lat_ts=50,lon_0=80');

my $img = $map->prepareImage();
if(!$img){warn "prepareImage() error: $mapscript::ms_error->{message}\n"; }

my $layerAdmin = $map->getLayerByName('admlin');
$layerObj->{status} = $mapscript::MS_ON;
$layerAdmin->draw($map, $img);

$img->save("maptest.gif");

################################################################

Example of map-file:

MAP
   NAME AllSat
   EXTENT -180 -90 180 90
   SIZE 800 400
   UNITS meters

   IMAGETYPE gif
   TRANSPARENT ON

   SHAPEPATH "/www/allsatwms/data"
   FONTSET "/www/allsatwms/fonts/fonts.list"

   LAYER
 NAME "admlin"
 GROUP "Admlin"
 PROJECTION
  "proj=longlat"
 END
 DATA admlin
 STATUS ON
 TYPE LINE
 CLASS
  NAME "admlin"
  COLOR 161 33 33
 END
   END

END

###############################################################

My system is: FreeBSD 5.3-RELEASE
Install swig-1.3.21_1 and perl-5.8.5

Hope for Your help. Best regards,
Efremov Victor, Space Monitoring Information Support laboratory IKI RAN,
Moscow, Russia.



More information about the mapserver-users mailing list