[mapserver-users] Mapscript - Adding shape to shapefile

Janet Ciavarelli Jciavarelli at city.kamloops.bc.ca
Wed May 23 16:44:46 EDT 2001


Hi,
   I am have a script where I create a point and then try to add the point to a shapefile. I keep getting the following error on the 'add' method for the shapefile Obj. Does anyone see what's wrong with my 'add' method in the code below?
=====================================================================================================
#!c:/Perl/bin/perl
use ENV;
use Win32;
use CGI;
use mapscript;

$query = CGI::new();
print $query->header();

if ($#ARGV == -1 && $ENV{'REQUEST_METHOD'} eq 'GET')
{
    print "point b\n";
    &GetGetArgs();
}

$shapefile = new shapefileObj('potholes',$mapscript::MS_SHP_POINT);
print "point w\n";
$point = new pointObj();
$point->{x} = $ar{mapx};
$point->{y} = $ar{mapy};

$shape = $point;
print "$shape->{x}\n";
print "$shape->{y}\n";


$shapefile->add($shape);   # This is the trouble line right here. It gives me the error message listed below
$shapefile = '';
============================================================================================
Usage: shapefileObj_add(self,shape); at c:/Perl/site/lib/mapscript.pm line 2386.

I've tried putting 2 arguments as well, but that doesn't seem to help either. The mapscript documentation says it needs only 1 argument and that should be the shape. So I'm stuck. Any ideas?

Janet.






More information about the mapserver-users mailing list