Welcome to this tutorial on Importing spreadsheets in QGIS.
In this tutorial, we will learn to,
Import spreadsheets in CSV format to create a Point Layer.
Convert Point Layer to a Polyline Layer and
Load WMS (Web Map Service) layer in QGIS.
To record this tutorial, I am using, Ubuntu Linux OS version 16.04.
QGIS version 2.18.
And a Working internet connection.
To follow this tutorial you should be familiar with QGIS interface.
If not for relevant tutorials please visit our website.
Often GIS data is available in table or spreadsheet format
Data in the form of spreadsheet can be imported to QGIS.
Data file must have 2 columns which contain the X and Y coordinates.
To practise this tutorial you need to download the folder given in Code files link, located below the player.
Extract the contents of the downloaded zip file.
Locate Places.txt and Places.csv files in the extracted folder.
I have already downloaded the code file, extracted and saved it in a folder on Desktop.
I will double-click on Code files folder to view the contents.
Here you will see 2 files Places.csv and Places.txt.
Double-click on Places.csv file.
A spreadsheet in CSV format opens.
It has names of cities with latitude and longitude data.
Close the CSV file.
Double-click and open Places.txt file.
Here too, we have names of cities, with longitude and latitude data.
Close the text file.
Close the Code-files folder and open QGIS interface.
Click on Layer menu on the menu bar.
From the drop-down list, select Add layer.
From the sub-menu, select Add Delimited Text Layer.
A dialog-box opens.
Click on Browse button next to File Name text box.
A dialog-box opens.
Navigate to the csv file you had downloaded and saved earlier.
Click on Open button.
In the create a layer dialog-box, the file path is now seen in the File Name text box.
In the File format section, by default CSV option gets selected.
If not, click on CSV radio button to select it.
When you use .txt file, select Custom Delimiters option.
Geometry definition section will be auto-populated with Latitude and Longitude data.
Please note X-coordinate is longitude and Y-coordinate is latitude.
Longitude specifies the east-west position of a point.
And Latitude specifies the north-south position of a point.
Click on OK button.
Coordinate Reference System Selector dialog-box opens.
Select WGS 84 EPSG 4326.
Click on OK button.
The data is imported and displayed on QGIS canvas.
A map of India opens with points.
These points correspond to different cities listed in the CSV file.
The style and color of these point features can be changed.
This will be demonstrated in detail in the upcoming tutorials.
As an assignment,
Import Places.txt file in QGIS.
Places.txt file is available in the folder downloaded from Code files link.
Now let us convert this Point layer to Polyline layer.
Here we will connect all the cities with a path.
The path connects southern-most city to the northern-most city.
This is based on latitude data of each city.
Click on Processing menu on the menu bar.
From the drop-down select Toolbox.
Processing Toolbox panel opens on the right-side of the screen.
It shows the list of all available algorithms grouped in different blocks.
Expand QGIS geoalgorithm by clicking on the black triangle next to it.
From the displayed list, expand Vector creation tools option.
From the expanded menu, double click on Points to path tool to execute the algorithm.
Points to path dialog-box opens.
Select Input layer as Places.
From the Group field drop-down, select type comma C comma 16.
This field contains the names of the cities for all the features in the shape file.
From the Order field drop-down, select Latitude comma N comma 19 comma 11.
This denotes the path will go in the ascending order of the latitude.
Click on the button next to Paths field.
From the sub-menu select Save to file option.
Save file dialog-box opens.
Select a suitable location to save the file. I will select Desktop.
Name the file as Path-1.
Click on Save button.
The path with file-name, appears on the Paths field.
Click the check box for Open output file after running algorithm.
Click on Run button at the bottom right corner of the dialog-box.
Notice the map on the canvas.
The output path between the cities is shown.
Using this algorithm any two points on the map can be connected by a path.
As an Assignment, Create a path between the cities from West to East.
Hint: In the Points to path dialog-box, Order field drop-down use Longitude comma N comma 19 comma 11 option.
Now let us add a WMS layer in QGIS.
About WMS
WMS stands for Web Map Services.
WMS is an open GIS standard specification for interactive mapping.
This is based on requesting map images from a server over the Internet.
For this demonstration you must be connected to the Internet.
Open any web browser.
In the address bar type bhuvan.nrsc.gov.in Press Enter.
Bhuvan home page opens.
Click on Thematic Services tab.
Thematic Services page opens in a new window.
In the left panel, under Search tab, under Select Theme drop-down, choose Land Use Land Cover (50K):2005-06 .
Under Select Geography drop-down, choose Karnataka.
Click on the Web Services tab.
Under section For QGIS, uDig, ArcGIS and Other Users, Web Map Service (WMS)URL
Note the Layer id for this layer. And highlight the URL.
Right-click and copy the URL.
Back to QGIS interface, In the Layers panel, uncheck the Paths and Place layers to hide them.
Click on Layer menu on the menu bar, from the drop-down, select Add Layer.
From the sub-menu, Select Add WMS/WMTS layer.
Add Layer dialog-box opens.
In the Layers tab click on New button.
Create a new WMS Connection dialog-box opens.
In Name field type Bhuvan.
In the URL field, paste the copied URL link from the Bhuvan website.
Click on OK button at the bottom-right corner of the dialog-box.
In the Save Connection dialog-box, click on OK button.
In the Add Layers dialog-box, click on Connect button.
In the id section, select id 971.
This id corresponds to to the id layer of the WMS layer from Bhuvan website.
Click on Add button at the bottom-right corner of the dialog-box.
Click on Close button.
On canvas, the Land Use Land Cover layer for Karnataka is displayed.
Similarly we can load any available layer of different themes.
Let us summarize, In this tutorial we have learnt to
Import spreadsheets in CSV format to create a Point Layer
Convert Point Layer to a Polyline Layer and,
Load WMS (Web Map Service) layer from Bhuvan website in QGIS.
The video at the following link summarizes the Spoken Tutorial project. Please download and watch it.
The Spoken Tutorial Project team: conducts workshops using spoken tutorials and gives certificates on passing online tests. For more details, please write to us.
Please post your timed queries on this forum.
Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India. More information on this mission is available at this link.
This tutorial is contributed by Prajwal M from NIT Suratkal and Snehalatha from IIT Bombay. Thank you for joining.