Adding vector data in context

“Vector data is the digital representation of geographic information in various forms as feature geometries”

Vector data is digital information that represents real-world objects, or features, that can be used in applications for data visualization and analysis. The common geometry types for the representation of vector information are points, lines, and polygons. Vector data can be stored in a variety of different formats, including GML/KML, Esri Shapefile, GeoJSON, and database formats such as Geopackage and PostGIS, amongst many others.

QGIS supports a wide variety of vector formats by leveraging the Geospatial Data Abstraction Library, or GDAL, to read and write various spatial data formats, and supports nearly 100 vector data types. Note, however, that although many data format types can be opened within QGIS, writing/ exporting is not supported for all file formats.

Vector data typically consists of distinct features, which may consist of multiple geometries or a single geometry element. Each feature is also usually associated with various attributes, which are tabular data records associated with distinct features.

QGIS is capable of creating new empty vector datasets in a variety of formats. QGIS also supports various additional layer types, including:

  • Temporary scratch layers: New features stored on the systems temporary file system which may be used for digitizing and analysis but will be deleted once the project is closed
  • Virtual layers: These layers can be derived from an existing data source using a query, such as obtaining a subset of records from a database table

Layers can also have many of their properties modified from within QGIS, such as the application of input data filters, modification of the data source, or the editing of layer metadata.

Once a layer has been created or added to a QGIS project, spatial data can be created, edited, or stored in the map layers. There are also many techniques for creating GIS new spatial data, including digitizing, importing GPS data, or converting tabular data such as spreadsheets that contain latitude and longitude positions into vector points.

You try:

Goal: To explore loading vector data into QGIS

Task 01: Opening vector data from the file browser

  • Download the exercise data and unzip the archive
  • Navigate to the exercise folder using the system file browser
  • Look at the layers in the folder and take note of the file extensions. If you do not see the extensions, you will need to change the folder preferences on your system.
  • Try to load a file, such as the osm_rivers.geojson, by dragging and dropping the data onto the map canvas in the QGIS interface
  • Now try to load the data from QGIS. Click the Open the Data Source Manager button on the Data Source Manager Toolbar, or navigate to the Layers Menu >> Add Layer >> Add Vector Layer
  • Ensure the Vector tab is selected in the Data Source Manager and click the ellipsis menu in the input Source field
  • Navigate to the exercise folder and select the osm_place shapefile layer. Note that there are multiple layers that make up a shapefile, so be sure to choose the correct one and note the file extension

Note that from the layer selection window, there is a type filter that allows you to easily view data of a specific data format.

Task 02: Opening vector data from the QGIS Browser Panel

  • Ensure the QGIS Browser panel is visible.
  • If it is not available, ensure the Browser panel is active from the View >>Panels menu
  • Dock the Browser panel to the QGIS interface if you have not yet done so
  • Use the browser panel to navigate to the exercise folder
  • Expand the Mann.gpkg in the browser and right-click the Mann layer from within the Geopackage
  • Right-click on the Mann layer and click add a layer to map canvas

Check your results

Did all of the data loading methods work for you?
If not, can you identify what when wrong?
How would you avoid problems in the future when loading vector data?
Did you manage to reorder the layers so that they are displayed optimally? You should have the towns on the top, rivers in the middle, and the area features at the bottom of the layer order
Were you able to identify the different data types in the file browser and the QGIS Browser?
Did you notice how the browser automatically identified suitable data types for you?
Did you try to use the drag and drop functionality from the QGIS Browser panel?
Can you figure out how to create new empty vector datasets from QGIS?

More about adding vector data

Vector layers are typically differentiated by their geometry types, such as points, lines, and polygons. Many file formats will support only one geometry type per file or per layer.

Points contain only a single coordinate pair. Points are typically used to model singular, discrete features, such as buildings, wells, power poles, and field sample collection or measurement locations. Points can also be used to represent an abstract of some other information, such as the center of a city or town. Points have only the property of location, or in instances where it is explicitly defined, they may include elevation (z) values, bearing (m), or in the case of event-driven or temporal data, time. Points can be analyzed and visualized in a number of interesting ways, such as performing hotspot analysis or to represent geotagged photographs.

Lines are composed of multiple, explicitly connected and ordered points. Lines are used to representing linear features such as road, railway and stream centrelines, geological faults, administrative boundaries, geographic lines such as the equator, and similar abstract representations. Lines have the property of length, and when used with bearing information, they may be used for route analysis.

Polygons are area features created by the enclosed region between multiple lines that are interconnected in a polygonal circuit. The "starting point", or first coordinate pair of a polygon, is the first point of the first line segment and is the same position as the "ending point", or the last coordinate pair of the last line segment. Polygons are used to represent area features such as administrative boundaries, city boundaries, geological formations, water bodies, soil associations, vegetation communities, and even climate data such as rainfall regions, amongst many others. Polygons have the properties of area and perimeter.

QGIS supports the utilization of curves and arcs within line and area features, however, whether this information will be persisted to other software platforms may depend on the method, mode, and format used to export, store, and migrate data as well as the capabilities of the target system.

Check your knowledge:

  1. Which of the following file extensions would you choose to add a shapefile into QGIS:

    1. dbf
    2. shx
    3. shp
    4. prj
  2. Can QGIS open KML files generated in Google Earth:

    1. Yes, if users purchase a license for the KML extension
    2. Yes, QGIS opens KML files natively
    3. Yes, but only using an official plugin