5. Začínáme

This chapter provides a quick overview of installing QGIS, downloading QGIS sample data, and running a first simple session visualizing raster and vector data.

5.1. Installing QGIS

QGIS project provides different ways to install QGIS depending on your platform.

5.1.1. Installing from binaries

Standard installers are available for win MS Windows and osx macOS. Binary packages (rpm and deb) or software repositories are provided for many flavors of GNU/Linux nix.

For more information and instructions for your operating system check https://download.qgis.org.

5.1.2. Installing from source

If you need to build QGIS from source, please refer to the installation instructions. They are distributed with the QGIS source code in a file called INSTALL. You can also find them online at https://github.com/qgis/QGIS/blob/release-3_28/INSTALL.md.

If you want to build a particular release and not the version in development, you should replace master with the release branch (commonly in the release-X_Y form) in the above-mentioned link (installation instructions may differ).

5.1.3. Installing on external media

It is possible to install QGIS (with all plugins and settings) on a flash drive. This is achieved by defining a –profiles-path option that overrides the default user profile path and forces QSettings to use this directory, too. See section System Settings for additional information.

5.1.4. Downloading sample data

This user guide contains examples based on the QGIS sample dataset (also called the Alaska dataset). Download the sample data from https://github.com/qgis/QGIS-Sample-Data/archive/master.zip and unzip the archive on any convenient location on your system.

The Alaska dataset includes all GIS data that are used for the examples and screenshots in this user guide; it also includes a small GRASS database. The projection for the QGIS sample datasets is Alaska Albers Equal Area with units feet. The EPSG code is 2964.

PROJCS["Albers Equal Area",
GEOGCS["NAD27",
DATUM["North_American_Datum_1927",
SPHEROID["Clarke 1866",6378206.4,294.978698213898,
AUTHORITY["EPSG","7008"]],
TOWGS84[-3,142,183,0,0,0,0],
AUTHORITY["EPSG","6267"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9108"]],
AUTHORITY["EPSG","4267"]],
PROJECTION["Albers_Conic_Equal_Area"],
PARAMETER["standard_parallel_1",55],
PARAMETER["standard_parallel_2",65],
PARAMETER["latitude_of_center",50],
PARAMETER["longitude_of_center",-154],
PARAMETER["false_easting",0],
PARAMETER["false_northing",0],
UNIT["us_survey_feet",0.3048006096012192]]

If you intend to use QGIS as a graphical front end for GRASS, you can find a selection of sample locations (e.g., Spearfish or South Dakota) at the official GRASS GIS website, https://grass.osgeo.org/download/data/.

5.2. Starting and stopping QGIS

QGIS can be started like any other application on your computer. This means that you can launch QGIS by:

  • using nix the Applications menu, win the Start menu, or osx the Dock

  • Dvakrát klikněte na ikonu ve složce „Aplikace“ nebo plocha zástupce.

  • double clicking an existing QGIS project file (with .qgz or .qgs extension). Note that this will also open the project.

  • typing qgis in a command prompt (assuming that QGIS is added to your PATH or you are in its installation folder)

To stop QGIS, use:

  • nix win volba menu Project ► Exit QGIS nebo použijte klávesovou zkratku Ctrl+Q

  • osx :menuselection: QGIS –> Quit QGIS nebo použijte klávesovou zkratku Ctrl+Q

  • or use the red cross at the top-right corner of the main interface of the application.

5.3. Sample Session: Loading raster and vector layers

Now that you have QGIS installed and a sample dataset available, we will demonstrate a first sample session. In this example, we will visualize a raster and a vector layer. We will use:

  • the landcover raster layer (qgis_sample_data/raster/landcover.img)

  • and the lakes vector layer (qgis_sample_data/gml/lakes.gml)

Where qgis_sample_data represents the path to the unzipped dataset.

  1. Start QGIS as seen in Starting and stopping QGIS.

  2. The data we will be working with are in Albers Equal Area, so let’s set the project’s CRS accordingly:

    1. Click the setProjection Select projection button in the bottom right of QGIS interface. The project properties dialog opens with the CRS tab active.

    2. Type ̀`2964` in the search Filter text area.

    3. Select the row with NAD27 / Alaska Albers CRS name.

      ../../../_images/selectCRS.png

      Obr. 5.1 Select the Coordinate Reference System of data

    4. Press OK

    Poznámka

    You can ignore/close for now the „ballpark transform“ message that could display.

  3. Load the files in QGIS:

    1. Click on the dataSourceManager Open Data Source Manager icon. The Data Source Manager should open in Browser mode.

    2. Browse to the folder qgis_sample_data/raster/

    3. Select the ERDAS IMG file rasterLayer landcover.img and double-click it. The landcover layer is added in the background while the Data Source Manager window remains open.

      ../../../_images/add_raster1.png

      Obr. 5.2 Adding data to a new project in QGIS

    4. To load the lakes data, browse to the folder qgis_sample_data/gml/, and drag and drop the dbSchema lakes.gml file over QGIS main dialog. (Or just double-click as mentioned above.)

    5. The Select Items to Add dialog opens, scanning the file. This is due to .gml file format being able to store more than one layer at a time.

      ../../../_images/addLayerItems.png

      Obr. 5.3 Select layers within a file

    6. In our case there is a single polygonLayer lakes layer. Select it and press Add Layers.

    7. The layer is added to the Layers panel

  4. Close the Data Source Manager window

In the Layers panel, you can notice that the lakes layer displays indicatorNoCRS Layer has no coordinate reference system set next to it. Let’s adjust that.

  1. Click the indicatorNoCRS icon. The Coordinate Reference System Selector dialog opens.

  2. As done earlier, find and select the NAD27 / Alaska Albers CRS entry.

  3. Click OK

You now have the two layers available in your project in some random colours. Let’s do some customization on the lakes layer.

  1. Select the zoomIn Zoom In tool on the Navigation toolbar

  2. Zoom to an area with some lakes

  3. Double-click the lakes layer in the map legend to open the Properties dialog

  4. To change the lakes color:

    1. Click on the symbology Symbology tab

    2. Select blue as fill color.

      ../../../_images/selectFillColor.png

      Obr. 5.4 Selecting Lakes color

    3. Press OK. Lakes are now displayed in blue in the map canvas.

  5. To display the name of the lakes:

    1. Reopen the lakes layer Properties dialog

    2. Click on the labelingSingle Labels tab

    3. Select Single labels in the drop-down menu to enable labeling.

    4. From the Label with list, choose the NAMES field.

      ../../../_images/showLabels.png

      Obr. 5.5 Showing Lakes names

    5. Press Apply. Names will now load over the boundaries.

  6. You can improve readability of the labels by adding a white buffer around them:

    1. Click the Buffer tab in the list on the left

    2. Check checkbox Draw text buffer

    3. Choose 3 as buffer size

    4. Click Apply

    5. Check if the result looks good, and update the value if needed.

    6. Finally click OK to close the Layer Properties dialog and apply the changes.

      ../../../_images/buffer_around_labels.png

      Obr. 5.6 Showing Buffers around Labels

Let’s now add some decorations in order to shape the map and export it out of QGIS:

  1. Select View ► Decorations ► Scale Bar menu

  2. In the dialog that opens, check checkbox Enable Scale Bar option

  3. Customize the options of the dialog as you want

  4. Press Apply

  5. Likewise, from the decorations menu, add more items (north arrow, copyright…) to the map canvas with custom properties.

  6. Click Project ► Import/Export ► saveMapAsImage Export Map to Image…

  7. Press Save in the opened dialog

  8. Select a file location, a format and confirm by pressing Save again.

  9. Press Project ► fileSave Save… to store your changes as a .qgz project file.

    ../../../_images/map_with_decorations.png

    Obr. 5.7 Showing Exported Map with Decorations

That’s it! You can see how easy it is to visualize raster and vector layers in QGIS, configure them and generate your map in an image format you can use in other softwares. Let’s move on to learn more about the available functionality, features and settings, and how to use them.

Poznámka

To continue learning QGIS through step-by-step exercises, follow the Training manual.