Although I have checked the "Create Legend" option in the qgis2leaf plugin, it did not generate any legend in the output webmap.
What am I missing here ?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
See their help page (on the help tab in the plugin UI):
When you're interested in building a legend as well, you need to fill the column legend_exp with a text and legend_ico with the path to an icon which should be shown in the legend for the particular layer. This works only for local layers and non-raster layers. See the example files for details.
you must provide a proper name in the attribute legend_exp and a path to an image of your choice in legend_ico.
ATM we check whether both columns are there and build the table from what is inside the first column entry:
if legend_ico_prov == True and legend_exp_prov == True: iter = i.getFeatures() for feat in iter: fid = feat.id() provider = i.dataProvider() legend_ico_index = provider.fieldNameIndex('legend_ico') legend_exp_index = provider.fieldNameIndex('legend_exp') attribute_map = feat.attributes() legend_icon = attribute_map[legend_ico_index] legend_expression = attribute_map[legend_exp_index] print legend_expression print legend_icon break legendStart += """<tr><td><img src='""" + unicode(legend_icon) + """'></img></td><td>"""+unicode(legend_expression) + """</td></tr>"""