Using the LegendControl feature to draw legends to leaflet powered maps

Our previous posts have demonstrated adding different format of legends to leaflet powered maps using HTML and CSS.

For this post, our example will use the Mapbox JS extension of leaflet to draw a legend programmatically to a web map.

 

Below is a screenshot of the demo displaying the legend with vertical boxes at the bottom right corner.

7

 

See live map by clicking:

http://mayotunde.github.io/mapboxlegendcontrol

 

See source code below:

nm-001

Download the plain text version of the source code by clicking the link below:

https://www.dropbox.com/s/5ry2f1l1i0hnaim/Using%20the%20LegendControl%20feature%20to%20draw%20legends%20to%20leaflet%20powered%20maps.txt?dl=0

 

Thank you for following the blog.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s