I'm manipulating mapfiles through mapscript. Setting layer attribute values like the opacity works like this:
$layer = $map->getLayer('layername'); //set an attribute value $layer->set('opacity', 80);
But now I want to set the data attribute as well, I assumed it functions like this:
$layer = $map->getLayer('layername'); //set an attribute value $layer->set('data', '/path/to/my/shape/file.shp');
But nothing happens, i.e. an image is constructed but it's empty because no data was inserted.
How can I set the data string?
PS: I'm using Mapserver 5.0.3 + Mapscript 4.10
EDIT: I used the map.getLayer() method instead of the getLayerByName method. While testing on the opacity attribute, I had a mapfile with only one layer, so the getLayer('loadlines') did return a (but in this case the last and correct) layer.