<link href='https://watergis.github.io/mapbox-gl-legend/mapbox-gl-legend.css' rel='stylesheet' />
<script src="https://watergis.github.io/mapbox-gl-legend/mapbox-gl-legend.js"></script>
<script>
map.on('load', function() {
const targets = {
'pipeline': 'Pipeline',
'pipeline_annotation': 'Pipeline Label',
'meter': 'Water Meter',
'flow meter': 'Flow Meter',
'valve': 'Valve',
'firehydrant': 'Fire Hydrant',
'washout': 'Washout',
'tank': 'Tank',
'tank_annotation': 'Tank Label',
'wtp': 'WTP',
'wtp_annotation': 'WTP Label',
'intake': 'Intake',
'intake_annotation': 'Intake Label',
'parcels': 'Parcels',
'parcels_annotation': 'Parcels Label',
'village': 'Village',
'village_annotation': 'Village Label',
'dma': 'DMA',
'dma-annotation': 'DMA Label',
'contour-line': 'Countour',
'contour-label': 'Contour Label',
'hillshade': 'Hillshade'
};
map.addControl(new watergis.MapboxLegendControl(targets, {
showDefault: false,
showCheckbox: false,
onlyRendered: true,
reverseOrder: true
}), 'top-right');
})
</script>