[mapserver-users] perl mapscript [SEC=UNCLASSIFIED]
Justyna Lubkowski
J.Lubkowski at bom.gov.au
Thu Dec 4 16:53:56 PST 2008
Hi,
Putting in the full path to the mapfile makes no difference the same
errors occur. Are the errors for setParameter a red herring?
Interestingly I've tried handing it both a valid map filename and a
filename that doesn't exist. When the mapfile doesn't exist it reports
"Mapfile error: No such file or directory". When the map file does
exist it doesn't report on the nature of the problem, but clearly it is
finding the file otherwise it would report "No such file or directory".
See below.
Is anyone using perl mapscript to do WxS services on mapserver 5.2?
======================================
Using no.map, which doesn't exist
======================================
$ ./minimal_wms.pl
Cannot setParameter SERVICE:
Cannot setParameter VERSION:
Cannot setParameter REQUEST:
Mapfile error: No such file or directory
Can't call method "OWSDispatch" without a package or object reference at
./minimal_wms.pl line 13.
======================================
Using minimal_wms.map
======================================
./minimal_wms.pl
Cannot setParameter SERVICE:
Cannot setParameter VERSION:
Cannot setParameter REQUEST:
Mapfile error:
Can't call method "OWSDispatch" without a package or object reference at
./minimal_wms.pl line 13.
#!/usr/bin/perl
use mapscript;
$req = new mapscript::OWSRequest( ) or warn "Cannot create request:
$!\n";
$req->setParameter( "SERVICE", "WMS" ) or warn "Cannot setParameter
SERVICE: $!\n";
$req->setParameter( "VERSION", "1.1.0" ) or warn "Cannot setParameter
VERSION: $!\n";
$req->setParameter( "REQUEST", "GetCapabilities" ) or warn "Cannot
setParameter REQUEST: $!\n";
#$map = new mapscript::mapObj( "no.map" ) or warn "Mapfile error: $!\n";
$map = new mapscript::mapObj( "minimal_wms.map" ) or warn "Mapfile
error: $!\n";
$map->OWSDispatch( $req );
-----Original Message-----
From: Kralidis,Tom [Ontario] [mailto:Tom.Kralidis at ec.gc.ca]
Sent: Thursday, 4 December 2008 11:41 PM
To: Justyna Lubkowski; Steve Lime; mapserver-users at lists.osgeo.org
Subject: RE: [mapserver-users] perl mapscript [SEC=UNCLASSIFIED]
> -----Original Message-----
> From: mapserver-users-bounces at lists.osgeo.org
> [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Justyna
> Lubkowski
> Sent: Thursday, 04 December 2008 00:33
> To: Steve Lime; mapserver-users at lists.osgeo.org
> Subject: RE: [mapserver-users] perl mapscript [SEC=UNCLASSIFIED]
>
> 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" );
The mapfile can't be found. Try changing this line to:
$map = new mapscript::mapObj( "minimal_wms.map" ) or warn "mapfile
error: $!\n";
..and you'll see the error.
Try pointing to the mapfile fullpath?
>
> $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
> > ===========================================
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
More information about the MapServer-users
mailing list