how to addfeature to line layer by perl

Lowell.Filak lfilak at MEDINACO.ORG
Tue Jun 12 15:06:45 EDT 2007


huanxiang xu writes: 

> I know how to addfeature to point layer,
> but how to addfeature to line layer 
> 
> my $layer=$map->getLayerByName('cruise');
>     my $poi=new mapscript::pointObj(182.880000,14.090000);my $poi1=new mapscript::pointObj(180.880000, 13.090000);
>     my $lin=new mapscript::lineObj();
>     $lin->add($poi);$lin->add($poi1);
>     my $shap=new mapscript::shapeObj();
>     $shap->add($lin);
>     #$layer->addFeature($shap);
>     return $map; 
> 
> Is it right?
> The perl give me the message: Can't call method "save" on an undefined value

xu, 

Check the following example. Even though it is for 3.X I believe you still 
need to assign at least an index to the shape before adding it to the layer.
HTH 

Lowell



More information about the mapserver-users mailing list