I'm adding a Stamen basemap to OpenLayers using the syntax below. Is it possible to change the layer's name, so that it appears in the Layer Switcher using this name (rather than "toner")?
The OpenLayers layer.setName method doesn't seem to work.
Thanks
<html>
<head>
<title>tile.stamen.com: OpenLayers</title>
<script type="text/javascript" src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript" src="http://maps.stamen.com/js/tile.stamen.js?v1.1.2"></script>
<script type="text/javascript">
var map, layer;
function initialize() {
map = new OpenLayers.Map('map', {controls: [new OpenLayers.Control.LayerSwitcher({})]});
stamenLayer = new OpenLayers.Layer.Stamen("toner");
stamenLayer.setName = "custom layer name";
map.addLayer(stamenLayer);
map.setCenter(new OpenLayers.LonLat(-13630355, 4546576), 10);
}
</script>
<style type="text/css">
#map {
width: 800px;
height: 600px;
}
</style>
</head>
<body onload="initialize()">
<div id="map"></div>
</body>
