Using QGIS2Leaflet plugin to create web maps from QGIS vector layers

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.

 

Download sample dataset – LowGDPAfrica.shp, africacities;

 

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.

Capture-2

 

Go to Vector on the main menu bar and choose Spatial Query > Spatial Query from

the drop down list.

Capture-4

 

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.

Capture-5

 

17 out of 50 cities are selected. Selected cities will be highlighted in yellow. Click Apply.

Capture-7

 

Go to Vector > Geoprocessing tools > Clip. This will create a new layer from the

selection or query we just performed.

Capture-8

 

Fill in the details for the Clip window as in the screenshot below. You can name

your output file differently.

Capture-9

 

A new layer-Urban_Areas (red boxed in the Layers window on the left

pane of the screenshot), is now added.

Capture-10

 

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.

Capture-22

 

image Click on the QGIS2leaflet plugin icon (red boxed)

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

Capture-24

 

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.

Capture-27

 

Thank you for following our demonstration.

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