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

Justyna Lubkowski J.Lubkowski at bom.gov.au
Wed Nov 26 16:49:33 PST 2008


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
===========================================





 
 
 
 

 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20081127/4d961e57/attachment.htm>


More information about the MapServer-users mailing list