I need to show several SVG icons (more than 388 icons) with different name on a single layer(if possible on memory layer). I am using QGis 2.8 and qt4.8.6 The icons represent different kind of entities such as: plane, radar, weapons and many more... They will be added to the layer at run time based on some preconditions. I've tried using categorized symboling but it only works for different symbols for different values, correct me if I am wrong. This is what I've tried so far and also tried categorized symboling but can't display the icons the way i want them to be displayed.
`QString IcoType1 = "Path to my icons";
QString src = "D:/NYC_MUSEUMS_GEO/NYC_MUSEUMS_GEO.shp";
QgsVectorLayer *layer2 = new QgsVectorLayer(src,"Symbol Layer","ogr");
QStringList MyPropertyName;
MyPropertyName << "fill" << "name" << "outline" << "outline-width" << "size";
// list of corresponding value 1
QStringList MyPropertyValue;
MyPropertyValue << "#f3e54d" << lBoyIcoType1 << "#000000" << "0" << "20";
QgsStringMap PropertyMap;
for (int i =0; i < MyBoyPropertyName.size(); i++){
PropertyMap.insert(MyPropertyName.at(i),MyPropertyValue.at(i));
}
QgsSymbolLayerV2* MySymbolLayer = QgsSvgMarkerSymbolLayerV2::create(PropertyMap);
layer2->rendererV2()->symbols(QgsRenderContext())[0]->changeSymbolLayer(0,MySymbolLayer);
layer2->rendererV2()->symbols(QgsRenderContext())[0]->appendSymbolLayer(MySymbolLayer);
QgsMapLayerRegistry::instance()->addMapLayer(layer2,TRUE);
QgsMapCanvas *canvas = new QgsMapCanvas(this);
QList<QgsMapCanvasLayer> layers;
layers.append(QgsMapCanvasLayer(layer2,TRUE));
canvas->setLayerSet(layers);
canvas->setExtent(layer2->extent());
showMaximized();
setCentralWidget(canvas);
`