changed getLayerIndex to getLegendIndex CDB-1073