[mapserver-users] perl mapscript [SEC=UNCLASSIFIED]

Justyna Lubkowski J.Lubkowski at bom.gov.au
Thu Dec 4 00:33:17 EST 2008


Hi Steve,

Thanks for your reply and the tar ball with the shapefiles and map file.

I've tried your map file with the following test script.

#!/usr/bin/perl

use mapscript;

$req = new mapscript::OWSRequest( );
$req->setParameter( "SERVICE", "WMS" );
$req->setParameter( "VERSION", "1.1.0" );
$req->setParameter( "REQUEST", "GetCapabilities" );

$map = new mapscript::mapObj( "minimal_wms.map" );

$map->OWSDispatch( $req ); 

The error message I get is:
Can't call method "OWSDispatch" without a package or object reference at
./minimal_wms.pl line 14.

I'm pretty sure that setParameter has not set SERVICE, VERSION OR
REQUEST.

Any ideas?

Cheers - Justyna.


-----Original Message-----
From: Steve Lime [mailto:Steve.Lime at dnr.state.mn.us] 
Sent: Tuesday, 2 December 2008 8:24 AM
To: Justyna Lubkowski; mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] perl mapscript [SEC=UNCLASSIFIED]

Your mapfile doesn't look to meet the minimum configuration requirements
for WMS. For example, there is no projection information defined. I have
a minimal WMS config example that I've attached for reference purposes. 

Steve

>>> On 11/26/2008 at 6:49 PM, in message
<29237876E2F56546975A098DC25F3D4A030AA211 at officeho2.bom.gov.au>,
"Justyna Lubkowski" <J.Lubkowski at bom.gov.au> wrote:
> Hi,
>  
> I'm hoping someone can help, I've been trying to get Perl mapscript to

> work using a couple of examples from the "MapScript wrappers for WxS 
> Services" page http://mapserver.gis.umn.edu/docs/howto/wxs_mapscript
>  
> Using python mapscript it works, when I run it on the command line I 
> get xml output, however if I try doing the same using perl mapscript I

> get no xml output on the command line, I get errors telling me that I 
> cannot set the SERVICE, VERSION or REQUEST parameters.  I've included 
> the python and perl scripts and their respective map files below.  If 
> I  try using $req->loadParams() in the script, and pass the same 
> parameters as part of the query string, then do a wget I get a zero
length file.
>  
> Am I doing something wrong?  Or is there a bug in perl mapscript?
>  
> Cheers - Justyna.
>  
> ===========================================
> #!/usr/bin/python
>  
> import mapscript
>  
> req = mapscript.OWSRequest()
> req.setParameter( 'SERVICE', 'WMS' )
> req.setParameter( 'VERSION', '1.1.0' ) req.setParameter( 'REQUEST', 
> 'GetCapabilities' )
>  
> map = mapscript.mapObj( 'test.map' )
> map.OWSDispatch( req )
> ===========================================
>  
> with the following map file
>  
> ===========================================
> MAP
>   SIZE 600 300
>   EXTENT -180 -90 180 90
>   IMAGECOLOR 180 180 250
>   IMAGETYPE PNG
>  
>   UNITS DD
>   WEB
>     IMAGEPATH "/html/tmp/wms"
>     IMAGEURL "/tmp/"
>     METADATA
>     OWS_ONLINERESOURCE "http://servername/test.py"
>     END
>   END
>  
>   LAYER
>     NAME  "coast_polygon"
>     TYPE  POLYGON
>     STATUS DEFAULT
>     DATA coast
>     CLASS
>       COLOR 231 220 189
>       OUTLINECOLOR 198 134 0
>       NAME "Coast "
>     END
>   END
> END
> ===========================================
>  
> I get the following errors using perl mapscript:
> cannot set wms parameter  at ./test3.pl line 6.
> cannot set version parameter  at ./test3.pl line 7.
> cannot set request parameter  at ./test3.pl line 8.
>  
> ===========================================
> #!/usr/bin/perl -w
>  
> use mapscript;
>  
> $req = new mapscript::OWSRequest() or die "no request";
> $req->setParameter('SERVICE','WMS') or warn "cannot set wms parameter 
> $!";
> $req->setParameter('VERSION','1.1.1') or warn "cannot set version 
> parameter $!";
> $req->setParameter('REQUEST','GetCapabilities') or warn "cannot set 
> request parameter $!";
>  
> $map = new mapscript::mapObj("test3.map") or die "no object";
>  
> $map->OWSDispatch( $req ) or die "cannot dispatch"; 
> ===========================================
>  
> and its mapfile is
>  
> ===========================================
> MAP
>   SIZE 600 300
>   EXTENT -180 -90 180 90
>   IMAGECOLOR 180 180 250
>   IMAGETYPE PNG
>  
>   UNITS DD
>   WEB
>     IMAGEPATH "/html/tmp/wms"
>     IMAGEURL "/tmp/"
>     METADATA
>     OWS_ONLINERESOURCE http://servername/test3.pl 
>     END
>   END
>  
>   LAYER
>     NAME  "coast_polygon"
>     TYPE  POLYGON
>     STATUS DEFAULT
>     DATA coast
>     CLASS
>       COLOR 231 220 189
>       OUTLINECOLOR 198 134 0
>       NAME "Coast "
>     END
>   END
> END
> ===========================================
> 
> 
> 
> 
> 
>  
>  
>  
>  
> 
>  
>  



More information about the mapserver-users mailing list