The QGIS2Leaflet plugin is an exciting tool that allows the GIS user to publish vector and raster layers created with QGIS to the web.
The most interesting part is that the process does not entail any form of coding or scripting.
Prepare your maps using QGIS and use the plugin to create a leaflet powered map!!!
First add the QGIS2Leaflet plugin to QGIS. Refer to QGIS documentation on how to add plugins to QGIS 2.8.
Let us prepare a map using QGIS.
Launch QGIS and add the sample datasets. A Point feature shapefile comprising
geographical locations of the most populated cities in Africa and a polygon feature
shapefile comprising administrative boundaries of the countries with the lowest GDP in Africa.
See the Layers window on the left pane of the screenshot.
Go to Vector on the main menu bar and choose Spatial Query > Spatial Query from
the drop down list.
In the Spatial Query window, we will select the point features that intersects the polygon shapefiles.
See screenshot for example. Click Apply. This query is to select cities that
are situated within the countries with the lowest GDP.
17 out of 50 cities are selected. Selected cities will be highlighted in yellow. Click Apply.
Go to Vector > Geoprocessing tools > Clip. This will create a new layer from the
selection or query we just performed.
Fill in the details for the Clip window as in the screenshot below. You can name
your output file differently.
A new layer-Urban_Areas (red boxed in the Layers window on the left
pane of the screenshot), is now added.
Increase the transparency of the polygon features to 60 and change the fill colour
of the markers to have the same look as the one on the screenshot below.
on the menu bar. This icon should appear once the plugin is installed into QGIS using the plugin manager.
A QGIS 2 Leaflet dialogue box will open. The QGIS 2 Leaflet plugin has some aspects
that are still in development. Click Get Layers to load the layers in the Layer window.
For this demonstration, leave most of the layer options unchecked. Fill the rest
details as on the example on the screen. Give the webpage a name and a title.
You can also add a subtitle like in the demo. Click OK
Viola!! the QGIS layers are now displayed as a leaflet web map in our web page with
a dynamic legend to the upper right side on the screenshot below.
Thank you for following our demonstration.