You are here

QGIS: An Introduction to an Open-Source Geographic Information System

Publication Number: P3269
View as PDF: P3269.pdf

Getting Started

Visual presentation is an effective method for relaying information to a variety of audiences. One of the most prevalent examples of visual information is mapping. Think about how many times you use or see a map on a given day. Almost all planning and research-related occupations can enhance their effectiveness by understanding mapping and geospatial analysis.

There are several mapping software programs; however, they are typically expensive and have a steep learning curve. QGIS (Quantum Geographic Information System) is a free, open-source software that allows users to create, edit, visualize, analyze, and publish geospatial information.

There are many benefits to using QGIS. First, the software offers many free online resources and maps available to download. QGIS also accepts many vector file formats. Finally, there are a variety of plug-ins for potential use, and there are always new plug-ins being created. Plug-ins are extra applications that can be downloaded to complete a specific task that is not easily accomplished otherwise.

This tutorial provides an introduction on how to download and operate QGIS. Even if you have little to no QGIS experience, you can learn to create basic maps and perform simple spatial analysis from several types of data inputs.

Using this Tutorial

Many of the guides will either be explained in a short paragraph or listed in the following format: First task > Second task > Third task > Etc.

Download the Software

Download the software at: https://qgis.org/en/site/forusers/download.html. The QGIS download may also install other supplementary applications. Newer versions of QGIS will create a different file format. These older files can be opened by the newer QGIS version, but any saved changes will exist in the new format. 

Now that QGIS is downloaded and opened, let’s look at some basic tools.

Use the plus and minus magnifying glass icons to select an area to zoom in or out of to a desired extent. Alternatively, single-click with the mouse while using these tools to zoom to a default extent. It is also possible to zoom in and out with the mouse wheel. 

Use the hand icon or the arrow keys to change the position of the map area within the viewing frame.

Use the magnifying glass with arrows to show the entirety of the largest visible layer.

Key Terminology

Attribute tables are similar to Excel spreadsheets. Attribute tables store information about the uploaded data and can be edited within QGIS. 

A basemap is the underlying reference map or layer used to orient the uploaded data in space.

A coordinate reference system (CRS) defines a map’s projection system. This transforms the map to be more accurate based on a local, regional, or global scale. After uploading a basemap or layer, assign a CRS. If the window to assign this does not automatically appear, right-click on the layer and select set layer CRS. Layers that do not have an appropriate CRS will have a layer viewed in the wrong location in comparison to the other layers.

Depending on the size and location of your data, you will use a different CRS. A basemap will typically use WGS84. Smaller-scale data can typically use a type of Universal Transverse Mercator (UTM) projection. UTM creates a constant distance relationship on the map and displays all units in meters. Several online resources describe/categorize UTM zones for any desired mapping areas; here is one example: https://mangomap.com/robertyoung/maps/69585/what-utm-zone-am-i-in-#.

Layers are used to display geographic datasets. Each layer references another dataset, and the map symbols and labeling are specified.

There are three main ways to display data: as points, lines, or polygons. A polygon is a series of points or a collection of lines that form a shape.

Query is a search to make only a specified section of data visible. This makes it easier to create multiple maps or to highlight differences within the same data. 

A raster file is an image file stored as pixels. Raster files are typically used for aerial or satellite imaging. Common raster file types are .geotiff or .tif.

Shapefile is a vector data format used to store geographic, symbol, and labeling information. A shapefile is a file format that creates layers. However, not all layers are shapefiles.

Basemap

Basemap is an underlying reference map or layer used to orient the uploaded data in space.

Required Files

The basemap and most layers exist in multiple file types: .shp, .shx, .cbg, .dbf, .prj, and .qpj. The .shp file is used to upload a layer into the QGIS workspace. However, do not delete the .shx file. The .shp and .shx file must both be in the file directory for QGIS to successfully upload the desired basemap or layer. Therefore, deleting the .shx file will result in an error.

It is common practice for a layer to be referred to only as a shapefile. When downloading a layer, the files will often include the necessary .shx file even though only the .shp file is mentioned.

The directory used when initially uploading and creating the file is recalled when returning to the map later. If the file is moved to another folder, QGIS will require a new directory to be established, or else that layer will be deleted.

Finding a Basemap

There are many resources to use when searching for a basemap, and many of them are free! Through patience and the right key words, any shapefile can be found. For a general search, use: “name of desired location” plus “desired information” plus “shapefile download.” For example, “Mississippi rivers shapefile download.”

Natural Earth is a good resource to give a general visualization of areas, but its basemaps are low resolution. Therefore, they are not appropriate for maps covering a small area. Basemaps including cities, states, countries, and water bodies can be found here. Download the large-scale data for the best resolution: https://www.naturalearthdata.com/downloads/.

NOAA has a variety of basemaps pertaining to weather and water: https://www.weather.gov/gis/AWIPSShapefiles.

USGS has 150-plus files across the U.S. that are searchable based on year, location, and topics, such as citizen science, coasts, and oceans: https://www.usgs.gov/products/data-and-tools/gis-data.

Mississippi Geospatial Clearinghouse has many maps for the state of Mississippi, searchable with a variety of census-based criteria: https://www.gis.ms.gov/.

The city of Mobile, Alabama, website houses Mobile basemaps with a variety of search criteria ranging from rivers to transportation routes: https://maps.cityofmobile.org/gis/gisdata_download.aspx.

Uploading Layers

A layer displays the spatial distribution of quantitative and qualitative data. The term “layer” broadly describes data shown as a raster, polygon, line, or point. A map is typically comprised of multiple layers over a basemap. A basemap is the layer that orients the map in space.

To upload a layer:

Drag and drop the .shp file into the layers panel.

OR

Layer > Add layer > Add vector layer > Browse > Open

Layers Panel

There are a variety of panels to view while working in QGIS. Arguably the most useful is the layers panel (View > Panels > Layers panel). This shows all layers that are currently uploaded. To make a layer visible/invisible, check the box beside the layer name.

The order of the layers in this panel is also important. The layers stack on top of one another. Therefore, the layer highest in the layers panel will appear on top of any layers below it. In the example below, when the ne_10m_land layer is above the water layer, the land covers the water. When the water layer is above the ne_10m_land layer, it is possible to see the entire water layer, and it covers portions of the land layer.  

Data without Coordinates

Add Data Points

If the relative location of a data point is known but the precise GPS coordinate is not known, there are two ways to bring the data into a usable form in QGIS.

1. Use Google Maps to acquire the GPS data point and record these values in an Excel sheet, and follow the Data with Coordinates section below.

OR

2. Layers > Create layer > New shapefile layer > Name the file > OK

Highlight this new layer in the layers panel > Toggle editing > Add feature > Select where to place the data point > Assign an ID value

The toggle icon (a yellow pencil) allows for a layer’s attribute table to be edited. In some cases, a layer may be locked and not editable. To unlock the layer, you must save the layer using save as. The new copy of the layer can then be toggled. Press toggle after completing all edits to save the layer changes.

Data with Coordinates

Upload Excel Data

Data’s latitudinal and longitudinal coordinates must first be recorded in an Excel spreadsheet. Then, the sheet must be saved as a comma separated variable (.csv) file. Comma separated variable is an easy-to-use format that QGIS can interpret.

  1. Add layer > Add delimited text layer… > Browse > Select CSV
  2. If first record has field names, indicate so.
  3. Identify longitude (x) and latitude (y) fields.

If you expect to need to enter additional data to the Excel/.csv sheet over time, then select watch file to link QGIS to the Excel sheet and automatically update any changes.

After uploading a basemap or layer, assign the CRS. If the window does not automatically appear, right-click on the layer and select set layer CRS. Remember, layers that do not have an appropriate CRS will have a layer viewed in the wrong location in comparison to the other layers.

Refer to the following link to identify which UTM zone projection is appropriate for your data: https://mangomap.com/robertyoung/maps/69585/what-utm-zone-am-i-in-#.

Data and Values

Attribute tables are like Excel spreadsheets. They store information about the uploaded data.   

When dealing with a specific layer, first select the layer in the layers panel.

Toggle allows for a layer’s attribute table to be edited. In some cases, a layer may be locked and unable to be edited. To unlock the layer, you must save the layer using save as. The new copy of the layer can then be toggled. Press toggle after completing all edits to save the layer changes.

Adding Columns

Select layer in the layers panel > Attribute table > Add fields > Type options describe the data in the field (text, whole number, etc.).

Length limits how long the cell data can be. Data longer than this value will be excluded. Therefore, it is best to input a conservative value.

To delete columns, select the delete column icon > Choose the column to be deleted

Field Calculator: Precision

Field calculator creates a field based on an equation or expression. This is especially useful for analyzing quantitative data. To open the field calculator:

Select polygon layer > Toggle > Attribute table > ctrl+I or Field calculator icon

Assign the following fields: output field name, output field type (like type options), precision (number of decimal places to be saved), expression.

Example calculator expressions are:       

  • $area — calculates the area of a polygon
  • $length — calculates the length of a line

Merging Files

In some cases, it may be useful to add a column of data from another Excel/.csv sheet or layer to the uploaded shapefile since it is easier to input data into Excel than the attribute table. If using the Excel file type, save as a .csv file before uploading to QGIS.

Before merging the files, be sure that the .csv file has one ID column identical to that of the previously uploaded shapefile so that QGIS knows which rows to match. If an ID column is not already created for the shapefile, use any value that will be unique for every row.

To upload the .csv file containing the new columns of data:

Layer > Add layer > Add delimited text layer… > File format > Select CSV (comma separated values) > Under geometry definition, select no geometry (attribute only table)

This will upload to the layers panel as a .dbf file.

To merge the two files:

  1. Double-click on the layer to be merged OR right-click > Properties
  2. Joins > + > Join layer > .dbf file name > Join field and target field must contain identical values that are unique per row > OK

The original shapefile should now have new columns from the merged .dbf file. You can select choose which fields are joined to select which columns will be included in the merge.

Data Point Appearance

Double-click on the layer name OR right-click > Layer properties > Style

From this screen, you can easily change the color and size of all data points.

Size

There are two ways to change the size of points.

  1. Change size of the points based on the values of a field. For example, if there is a density column, use it to vary the size of a point based on the sizes of the density values.
    • Data defined override (field) > Field type > Column that will vary size
  2. Change size of the points incrementally within a field. For example, when using a density column, instead of a value directly correlating to the size of the points, this value is used to sort the data into a number of classes. These classes or breaks in the data will correlate to a change in size.

Select graduated instead of single symbol. Using graduated allows you to identify the number of classes or breaks in the data. Select whether size or color will be changed. Use mode to distribute the intervals. The final step is to select classify and apply.

Color

There are multiple ways to change the color of a points layer.

  1. Under the color heading, select the sample color to open the select color panel. Choose a desired color.
  2. Within the select color panel, use the dropper to match a color already on the map.
  3. Instead of using the select color panel, you can choose recent and standard colors.
  4. Refer to the previous size section on graduated symbols to learn how to change the color of the points incrementally.

Background Color

Sometimes it’s necessary to view the background of QGIS in a color other than default (for example, white) while creating a final map product.

Project > Project properties OR Ctrl+Shift+P > General > Background color (same as changing color for data points)

Symbol Shape

To change the symbol associated with a data point:

1. Double-click on the layer name in the layers panel

OR

2. Right-click > Layer properties > Style

Three different symbol layer types will be discussed: simple, SVG, and font markers.

Simple Marker

A simple marker covers a variety of basic symbols and geometric shapes from circles to hexagons.

SVG Marker

An SVG marker is more complex than a simple marker, and there’s a wide range of nongeometric symbols to choose from.

First, under symbol layer type, ensure that the SVG marker is selected. The size, location, and color of the symbol can be adjusted in the current styles window. At the bottom of the window, a selection of symbols is categorized. It is also possible to create a .svg file in Adobe Illustrator or convert an image to .svg with an online converter and upload it to QGIS.

Font Marker

A font marker uses alphanumeric characters to display data location.

First, under symbol layer type, ensure that font marker is selected. The size, location, and color of the symbol can be adjusted in the styles window. At the bottom of the window, there are symbols to choose from. 

If a more complex string of characters is desired:

Data defined override > Edit > Insert any expression or field value into box to become the symbol

Print Composer

Use print composer to add the finishing touches to a map or project and prepare it for export.

Upload map   

Project > New print composer > Assign the map a composer title to save as 

Upload a map project and drag the map to the desired size over the workspace. Change the size of the workspace in the composition window and select from the drop-down menu of presets under page size.

In some scenarios, it may be useful to upload more than one map project at a time. Repeat the same steps to overlay maps.

Think of this image as a window into the main QGIS window where the map project lies. To change the layout or position of the map project on the workspace, go to item properties and select set to map canvas extent. This will change the position of the map to that seen in the main QGIS window. Adjust the view in the main QGIS window and repeat these steps until the map appears as desired.

Finally, to create a border around a map, go to item properties and select frame. From here, you can adjust the color and thickness of the border.

Add Scale/Legend

Add a scalebar to the print composer map. Edit the scalebar under item properties. If more than one map is present, select which map the scalebar should be fitted to. Under style, you can change the appearance, units, and multiplier of the scalebar. The number of segments on each side of the 0 on the scalebar can also be edited.

Add a legend to the print composer map. Edit the legend by selecting legend items within item properties. By default, the legend will include the name of all layers present in the main QGIS window. If you want fewer labels, deselect auto update, highlight the layers to be deleted, and click the delete button.

Using PowerPoint

Once you have added the basic components of the map, such as a scale and a legend, you can export the map as a jpeg.

Composer > Export as Image

You can then upload this image to Microsoft PowerPoint so it can be more easily edited. For example, titles and other images can be easily overlaid and edited within PowerPoint.

These modifications can also be done within the print composer window. All editing for these features can be done in the item properties.

Extras

Data Subsets

To focus on or observe only a subset of the data, you can run a query. A query will make only a specified section of data visible, making it easier to create multiple maps or to highlight differences within the same data.

Query

Double-click on the shapefile layer to be merged

OR

Right-click > Properties > General > Query builder (scroll down on the window if not visible) > Input statement to select the data

There are two main ways to accomplish this:

  1. Select a field value and set it equal to an ID value. For example, “Gender” = ‘female’, “Color” = ‘blue’, or “field” = ‘0.49’. The field value must have double quotations and the ID value must have single quotations.
  2. Create a column specifically for the query. Add a field in the attribute table for the query or include a column in the Excel table before uploading it to QGIS. For simplicity, label the column “query.” Put a value of 1 in each row that would be kept. Then, “query” = ‘1’ would be the line of code needed to carry out the query.

Select Data and Run Basic Statistics

Select features using any of the selection tools > Highlight the desired data > Vector > Analysis tools > Basic statistics for numeric fields > Identify the layer and field to run statistics on > Run

Plug-ins

Basic Working Knowledge

Plug-ins are extra applications that can be downloaded to complete a specific task that is not easily accomplished otherwise. Unfortunately, in the newer versions of QGIS, it takes time for popular plug-ins to be updated. However, new plug-ins are always being created and added.

Experimental plug-ins are in the early stages of development. They may have some kinks or may not be as user-friendly.

Deprecated plug-ins are unmaintained or obsolete and should be avoided.

Where to Find Them

Plug-ins > Manage and install plug-ins

To view experimental or deprecated plug-ins: Plug-ins > Manage and install plug-ins > Settings > Show also experimental plug-ins > Show also deprecated plug-ins

Examples

Georeferencer

Georeferencer is used to create basemaps from Google Maps.

Obtain picture of desired location from satellite images via print screen or Snipping tool > Raster > Georeferencer (install plug-in if not present) > File > Open raster > Select desired image > Open

Add at least three points spaced across the image so that QGIS can accurately place the image in space.

Add point > Insert X/east coordinate > Insert Y/north coordinate > OK

It is also possible to obtain these coordinates from the current main QGIS window if a layer is already uploaded that gives some way to reference locations.

Then you can take the inputted information and image and create the basemap. The image cannot be simply laid on top of the map because all the reference points most likely will not match up exactly. You will have to distort or stretch the image to mimic the curvature of the earth or the reference system being used.

Transformation settings > Transformation type > Thin plate spline > Output raster > Assign location to be saved > OK

Thin plate spline

Thin plate spline is a type of transformation that keeps the added data points in place and introduces local deformations or distortions. It is commonly used for low-quality referenced images. An explanation of the other options of transformations can be found at https://gis.stackexchange.com/questions/153227/transformation-types-in-geo-referencing-of-qgis.

The final step is to start georeferencing.  

A new layer should now be visible in the layers panel and show the referenced image where it is in space. If the image does not appear, first try changing the CRS.

Auto-trace

Auto-trace creates polygons or lines within a layer through freehand tracing.

This plug-in is useful for creating a polygon/line by tracing points or using other visual markers within the layer. 

Select polygon or line layer > Toggle > Auto-trace in plug-in toolbar (install plug-in if not present) > Connect points or freehand to create polygon > Right-click when complete > Any attributes for the layer can then be inputted

Points2One

Points2One creates polygons and/or lines from points for more complex or larger shapes. It may be necessary to isolate the polygon/line feature first. To do so:

Select layer > Select features by freehand > Select all desired points that will make up the feature > Right-click over layer with point data > Save as > Select save only selected features > Browse and assign a file output name > OK

To use the Points2One plug-in:

Points2One plug-in in vector toolbar (install plug-in if not present) > Input vector layer > Create polygons OR lines > Browse: assign output shapefile directory > Add result to canvas > OK

TimeManager

TimeManager shows the movement of points over time. This plug-in can show spatial movement or show a change in direction using arrows or symbols. When uploading the .csv file, make a column with either the position of the point or the degree of change.

Plug-ins > TimeManager (install plug-in if not present) > Toggle visibility

Under the TimeManager window, select settings. This requires a layer to be uploaded with a column for time formatted in MM/DD/YYYY hh:mm:ss.

Add Layer > Assign layer > Assign start time > OK

Under animation options, the time and date can be made visible on the map by selecting display frame start time on map. The duration of each slide can also be edited.

Power on the time manager window. Be sure that the first desired time and date is displayed on the time frame start window. Then, select export video once the desired animation is achieved. This will be exported as individual slides; then paste them together using another application such as Microsoft Photos.

Resources

Forums

Search this forum for a number of previously asked questions and scenarios: https://gis.stackexchange.com/questions/

This site has countless tutorials and examples for all skill levels on a variety of applications within QGIS: https://www.qgistutorials.com

Videos

The “QGIS Uncovered” YouTube videos give a working knowledge of QGIS for people with no background experience: https://www.youtube.com/watch?v=lg9ceXoCUFE&list=PL7HotvlLKHCs9nD1fFUjSOsZrsnctyV2R


Publication 3269 (POD-10-21)

MASGP-18-038

By Gillian Palino, Intern, and Eric Sparks, PhD, Associate Extension Professor and Director, Coastal and Marine Extension Program.

Department: CREC-Coastal Marine Ext Program, CREC-Coastal Research & Ext Center
Print Friendly, PDF & Email

The Mississippi State University Extension Service is working to ensure all web content is accessible to all users. If you need assistance accessing any of our content, please email the webteam or call 662-325-2262.

Authors

Portrait of Dr. Eric L Sparks
Associate Professor & Director
coastal conservation and restoration, living shorelines, marine debris, environmental stewards

Your Extension Experts

Portrait of Dr. Daryl Jones
Extension Professor
Portrait of Dr. Adam Rohnke
Assistant Extension Professor

Related Publications

Publication Number: P3772
Publication Number: P3770
Publication Number: P2307
Publication Number: P146

Pages