mapscript - layerObj.clone()

Lowell Filak lfilak at MEDINACO.ORG
Mon Oct 24 07:34:11 PDT 2005


The following message was sent by Jachym Cepicky
<jachym.cepicky at CENTRUM.CZ> on Sat, 22 Oct 2005 14:31:20 +0200.

> Hallo,
> I would like to copy one layer, modify its attributes and print it to
> result map (perl MapScript):
> 
> [...]
> my $newLayer = mapscript::layerObj($mapObj);
> $newLayer = $layerObj->clone();
> $searchLayer->{status} = 1;
> 
> 
> my $imgObj = $mapObj->draw() or die('Unable to draw map');
> $imgObj->save("/home/jachym/tmp/smaz/pokus.png"
> 
> 
> But there is nothing in resulting image :-( What to do?

Jáchym,

I'm not following what is occurring in the code.
It appears to say:
Create a new & empty layerobject named $newLayer then create a new
layerobject named $newLayer by cloning it from an existing layer named
$layerObj and from there it because a bit more confusing as none of the
operations seem to initiate values for $newLayer.
There was a recent discussion that may help explain what 'new' objects
have defaults and which don't:
search the october archives for 'Problems translating map file layers to
mapscript'.

Lowell



More information about the MapServer-users mailing list