Do you want to add an ESRI shapefile layer to QGIS? The ESRI shapefile is undoubtedly the most widely used vector format in the GIS world. The Shapefile format does not only allow you to easily manage point, line and polygon layers in QGIS but it also gives you a user friendly interface to manage the attributes of your vector data in QGIS. In this article, we will show you how to easily add a shapefile to your QGIS canvas.
Why Is The Shapefile Important?
Normally, there are many vector formats that you can use in QGIS in the place of Shapefile. For example, QGIS is capable of using GeoJson, Geoconcept, Spatiallite, GeoRSS, GML (Geography Markup Language) to mention only a few vector file formats. Each of these vector formats has its pros and cons.
Easy to use
However, many times you will need a file format that is simple to create and manipulate. The shapefile format is simple and stores Geo-spatial data as basic points, lines and polygons. It also links each shape’s geographic data with its attribute data. This is undoubtedly the simplest file format we can think of today in GIS.
If you are producing a vector layer for a client, then you don’t want your client to experience difficulty in opening the vector layers that you have created for him. That could create a bad experience and give them a poor impression of your service. Virtually every GIS software (free and proprietary) is capable of creating, importing, exporting and doing Geo-spatial analysis on ESRI shapefile. So, Shapefile is a universal vector file format.
Shapefile format in QGIS allows you to economise space on your computer. This might not seem obvious in the first place but as you go higher in your GIS career you will have more vector and raster files on your PC than you can remember at any point in time. If you don’t make yourself acquitted with using the shapefile format in QGIS you might end up overburdening yourself with the task of constantly clearing storage space for your files.
Also, just as you want to economise space on your computer you also want to help your clients economise space on their computer. Not only that, you would also be saving yourself and your client(s) from spending useful time and effort on sending and downloading vector files. In summary, Esri shapfile format is what we at GeoAfrikana would recommend for anyone.
Three ways to add Shapefile to your QGIS Canvas
That said, let’s take a look at how to easily add an ESRI shapefile to QGIS canvas.
You’ll learn two different methods of adding the shapefile to your QGIS canvas. You can choose the one that works best for you.
Video: How to Add Shapefile to QGIS
Subscribe to GeoAfrikana
If you don’t want to watch the video tutorial, then you can continue reading the text version below:
Note: this tutorial uses Windows operating system. If you are using another operating system such as Linux or Mac OS X then simply follow the instructions closely, the process is quite the same.
1. Add Shapefile to QGIS Canvas Using Windows Explorer
Firstly, you need to open your Windows Explorer, (that is obviously after you have fired up QGIS). A simple way to do that is to press E while holding down the windows key on your keyboard.
Upon opening your windows explorer, you need to go to the folder that contains the shapefiles that you wish to add to your QGIS canvas. You will need to unzip your file if it is in a compressed zip folder.
On getting to the folder, you will see that there are more than one file type in there. If you thought shapefile refers to just one file then you have been misled by the name (which is quite normal). ESRI shapefile consists of files that have a common name but different extensions. The Natural Earth Quick Start Kit for example contains seven file extensions for each shapefile; CPG, DBF, PRJ, HTML SHP, SHX, TXT.
PRJ contains the project coordinates (longitude and latitudes), DBF is the database that contains the attributes of the features, SHX contains the index format, CPG contains the code page, and TXT and HTML are important but not fundamental. The most important of all is the SHP file which contains the geometry of the features, little wonder ESRI named the whole pack after it.
Each of the extensions is indispensable; deleting or altering any of them could break or destroy your shapefile. So, whatever you do proceed with caution and you should only do what you really know.
Also, all the files of a shapefile must be in a common folder and they must share the same name else QGIS (and all other GIS software for that matter) will not recognize it.
Now simply restore (not minimise) your windows explorer window so that your QGIS canvas is visible underneath. A simple way to achieve this is to press the right arrow key while holding down the windows key on your keyboard. Your screen should look like the screenshot above.
Lastly, drag the part of the shapefile that has the .SHP extension and drop it in the QGIS canvas and Voila! You have added your shapefile to your QGIS canvas.
2. Add Shapefile to QGIS Using QGIS Browser
The second method is to use the QGIS browser to add your shapefile to QGIS canvas.
As you continue to work with QGIS you will soon discover that browsing through your windows explorer every time you need to add a shapefile to QGIS is quite uneasy. Luckily, QGIS has an inbuilt browser that lets you browse the folders of your computer without leaving your QGIS window.
First you need to enable the browser panel in your QGIS interface. Go to view »panels and click on browser.
A panel should appear on the left side of your QGIS interface, go to C:\ » Users and continue navigating till you reach the folder of your choice. The cool thing about this method is that QGIS will show only the .SHP extension of your shapefile.
You can either drag the .SHP file and drop it on your canvas or right-click on the .SHP file and click on “Add Selected Layer(s) to Canvas.
3. Add Shapefile with add vector button
The third method of adding shapefile to your QGIS canvas is by using the add vector button.
On the left-hand side of your QGIS window, there are some buttons arranged horizontally (from top to bottom). These buttons are there for easy access to frequently used functions. Those buttons belong to a toolbar called the manage layers toolbar. The manage layers toolbar, as the name shows, lets you manage layers by adding any type of layer to the QGIS canvas.
If the manage layers toolbar is not enabled yet then go to view» toolbars» manage layers toolbar and you should see it appear on your screen.
Click on the add vector layer button. It is the first button on the toolbar and has a V-shaped icon.
A dialogue box should appear. Click on the button with three dots (see the screenshot above).
Navigate to the location of your shapefile on your computer. Select the part that has .SHP extension as is in the first method. Click open. Then click add in the add vector dialogue box.
That’s it. Your shapefile is on your canvas!
We hope this article helped you learn how to easily add shapefile to QGIS.
Over to you, did you learn any new method? Which of the methods do you use most frequently?
Perhaps there is a fourth method? I’ll be glad to learn from you.