15.1. Opening Data

As part of an Open Source Software ecosystem, QGIS is built upon different libraries that, combined with its own providers, offer capabilities to read and often write a lot of formats:

  • Vector data formats include GeoPackage, GML, GeoJSON, GPX, KML, Comma Separated Values, ESRI formats (Shapefile, Geodatabase…), MapInfo and MicroStation file formats, AutoCAD DWG/DXF, GRASS and many more… Read the complete list of supported vector formats.

  • Raster data formats include GeoTIFF, JPEG, ASCII Gridded XYZ, MBTiles, R or Idrisi rasters, GDAL Virtual, SRTM, Sentinel Data, ERDAS IMAGINE, ArcInfo Binary Grid, ArcInfo ASCII Grid, and many more… Read the complete list of supported raster formats.

  • Database formats include PostgreSQL/PostGIS, SQLite/SpatiaLite, Oracle, MS SQL Server, SAP HANA, MySQL…

  • Web map and data services (WM(T)S, WFS, WCS, CSW, XYZ tiles, ArcGIS services, …) are also handled by QGIS providers. See Working with OGC / ISO protocols for more information about some of these.

  • You can read supported files from archived folders and use QGIS native formats such as QML files (QML - The QGIS Style File Format) and virtual and memory layers.

More than 80 vector and 140 raster formats are supported by GDAL and QGIS native providers.

Note

Not all of the listed formats may work in QGIS for various reasons. For example, some require external proprietary libraries, or the GDAL/OGR installation of your OS may not have been built to support the format you want to use. To see the list of available formats, run the command line ogrinfo --formats (for vector) and gdalinfo --formats (for raster), or check the Settings ► Options ► GDAL menu in QGIS.

In QGIS, depending on the data format, there are different tools to open a dataset, mainly available in the Layer ► Add Layer ► menu or from the Manage Layers toolbar (enabled through View ► Toolbars menu). However, all these tools point to a unique dialog, the Data Source Manager dialog, that you can open with the dataSourceManager Open Data Source Manager button, available on the Data Source Manager Toolbar, or by pressing Ctrl+L. The Data Source Manager dialog (Fig. 15.1) offers a unified interface to open file-based data as well as databases or web services supported by QGIS.

../../../_images/datasource_manager.png

Fig. 15.1 QGIS Data Source Manager dialog

Beside this main entry point, you also have the dbManager DB Manager plugin that offers advanced capabilities to analyze and manipulate connected databases. More information on DB Manager capabilities can be found in DB Manager Plugin.

There are many other tools, native or third-party plugins, that help you open various data formats.

This chapter will describe only the tools provided by default in QGIS for loading data. It will mainly focus on the Data Source Manager dialog but more than describing each tab, it will also explore the tools based on the data provider or format specificities.

15.1.1. The Browser Panel

The Browser is one of the main ways to quickly and easily add your data to projects. It’s available as:

  • a Data Source Manager tab, enabled pressing the dataSourceManager Open Data Source Manager button (Ctrl+L);

  • as a QGIS panel you can open from the menu View ► Panels (or kde Settings ► Panels) or by pressing Ctrl+2.

In both cases, the Browser helps you navigate in your file system and manage geodata, regardless the type of layer (raster, vector, table), or the datasource format (plain or compressed files, databases, web services).

15.1.1.1. Exploring the Interface

At the top of the Browser panel, you find some buttons that help you to:

  • addLayer Add Selected Layers: you can also add data to the map canvas by selecting Add selected layer(s) from the layer’s context menu;

  • refresh Refresh the browser tree;

  • filterMap Filter Browser to search for specific data. Enter a search word or wildcard and the browser will filter the tree to only show paths to matching DB tables, filenames or folders – other data or folders won’t be displayed. See the Browser Panel(2) example in Fig. 15.2. The comparison can be case-sensitive or not. It can also be set to:

    • Normal: show items containing the search text

    • Wildcard(s): fine tune the search using the ? and/or * characters to specify the position of the search text

    • Regular expression

  • collapseTree Collapse All the whole tree;

  • metadata Enable/disable properties widget: when toggled on, a new widget is added at the bottom of the panel showing, if applicable, metadata for the selected item.

The entries in the Browser panel are organised hierarchically, and there are several top level entries:

  1. Favorites where you can place shortcuts to often used locations

  2. Spatial Bookmarks where you can store often used map extents (see Bookmarking extents on the map)

  3. Project Home: for a quick access to the folder in which (most of) the data related to your project are stored. The default value is the directory where your project file resides.

  4. Home directory in the file system and the filesystem root directory.

  5. Connected local or network drives

  6. Then comes a number of container / database types and service protocols, depending on your platform and underlying libraries:

    • geoPackage GeoPackage

    • spatialite SpatiaLite

    • postgis PostgreSQL

    • hana SAP HANA

    • mssql MS SQL Server

    • oracle Oracle

    • wms WMS/WMTS

    • vectorTileLayer Vector Tiles

    • xyz XYZ Tiles

    • wcs WCS

    • wfs WFS/OGC API-Features

    • afs ArcGIS REST Server

15.1.1.2. Interacting with the Browser items

The browser supports drag and drop within the browser, from the browser to the canvas and Layers panel, and from the Layers panel to layer containers (e.g. GeoPackage) in the browser.

Project file items inside the browser can be expanded, showing the full layer tree (including groups) contained within that project. Project items are treated the same way as any other item in the browser, so they can be dragged and dropped within the browser (for example to copy a layer item to a geopackage file) or added to the current project through drag and drop or double click.

The context menu for an element in the Browser panel is opened by right-clicking on it.

For file system directory entries, the context menu offers the following:

  • New ► to create in the selected entry a:

    • Directory…

    • GeoPackage…

    • ShapeFile…

  • Add as a Favorite: favorite folders can be renamed (Rename favorite…) or removed (Remove favorite) any time.

  • Hide from Browser: hidden folders can be toggled to visible from the Settings ► Options ► Data Sources ► Hidden browser paths setting

  • Fast Scan this Directory

  • Open Directory

  • Open in Terminal

  • Properties…

  • Directory Properties…

For leaf entries that can act as layers in the project, the context menu will have supporting entries. For example, for non-database, non-service-based vector, raster and mesh data sources:

  • Export Layer ► To File…

  • Add Layer to Project

  • Layer Properties

  • Open with Data Source Manager…

  • Manage ► Rename “<name of file>”… or Delete “<name of file>”…

  • Show in Files

  • File Properties

In the Layer properties entry, you will find (similar to what you will find in the vector and raster layer properties once the layers have been added to the project):

  • Metadata for the layer. Metadata groups: Information from provider (if possible, Path will be a hyperlink to the source), Identification, Extent, Access, Fields (for vector layers), Bands (for raster layers), Contacts, Links (for vector layers), References (for raster layers), History.

  • A Preview panel

  • The attribute table for vector sources (in the Attributes panel).

Use Open with Data Source Manager… to directly open and configure the data source in the Data Source Manager using the URI of your data source. This simplifies the process of adding a layer from the Browser by allowing you to set specific opening options for the data source. It is currently available for vector (including the dedicated GeoPackage entry), raster, and SpatiaLite data sources.

To add a layer to the project using the Browser:

  1. Enable the Browser as described above. A browser tree with your file system, databases and web services is displayed. You may need to connect databases and web services before they appear (see dedicated sections).

  2. Find the layer in the list.

  3. Use the context menu, double-click its name, or drag-and-drop it into the map canvas. Your layer is now added to the Layers panel and can be viewed on the map canvas.

    Tip

    Open a QGIS project directly from the browser

    You can also open a QGIS project directly from the Browser panel by double-clicking its name or by drag-and-drop into the map canvas.

Once a file is loaded, you can zoom around it using the map navigation tools. To change the style of a layer, open the Layer Properties dialog by double-clicking on the layer name or by right-clicking on the name in the legend and choosing Properties from the context menu. See section Symbology Properties for more information on setting symbology for vector layers.

Right-clicking an item in the browser tree helps you to:

  • for a file or a table, display its metadata or open it in your project. Tables can even be renamed, deleted or truncated.

  • for a folder, bookmark it into your favourites or hide it from the browser tree. Hidden folders can be managed from the Settings ► Options ► Data Sources tab.

  • manage your spatial bookmarks: bookmarks can be created, exported and imported as XML files.

  • create a connection to a database or a web service.

  • refresh, rename or delete a schema.

You can also import files into databases or copy tables from one schema/database to another with a simple drag-and-drop. There is a second browser panel available to avoid long scrolling while dragging. Just select the file and drag-and-drop from one panel to the other.

../../../_images/browser_panels.png

Fig. 15.2 QGIS Browser panels side-by-side

Tip

Add layers to QGIS by simple drag-and-drop from your OS file browser

You can also add file(s) to the project by drag-and-dropping them from your operating system file browser to the Layers Panel or the map canvas.

15.1.2. The DB Manager

The DB Manager Plugin is another tool for integrating and managing spatial database formats supported by QGIS (PostGIS, SpatiaLite, GeoPackage, Oracle Spatial, MS SQL Server, Virtual layers). It can be activated from the Plugins ► Manage and Install Plugins… menu.

The dbManager DB Manager Plugin provides several features:

  • connect to databases and display their structure and contents

  • preview tables of databases

  • add layers to the map canvas, either by double-clicking or drag-and-drop.

  • add layers to a database from the QGIS Browser or from another database

  • create SQL queries and add their output to the map canvas

  • create virtual layers

More information on DB Manager capabilities is found in DB Manager Plugin.

../../../_images/db_manager.png

Fig. 15.3 DB Manager dialog

15.1.3. Provider-based loading tools

Beside the Browser Panel and the DB Manager, the main tools provided by QGIS to add layers, you’ll also find tools that are specific to data providers.

Note

Some external plugins also provide tools to open specific format files in QGIS.

15.1.3.1. Loading a layer from a file

To load a layer from a file:

  1. Open the layer type tab in the Data Source Manager dialog, ie click the dataSourceManager Open Data Source Manager button (or press Ctrl+L) and enable the target tab or:

    • for vector data (like GML, ESRI Shapefile, Mapinfo and DXF layers): press Ctrl+Shift+V, select the Layer ► Add Layer ► addOgrLayer Add Vector Layer menu option or click on the addOgrLayer Add Vector Layer toolbar button.

      ../../../_images/addvectorlayerdialog.png

      Fig. 15.4 Add Vector Layer Dialog

    • for raster data (like GeoTiff, MBTiles, GRIdded Binary and DWG layers): press Ctrl+Shift+R, select the Layer ► Add Layer ► addRasterLayer Add Raster Layer menu option or click on the addRasterLayer Add Raster Layer toolbar button.

      ../../../_images/addrasterlayerdialog.png

      Fig. 15.5 Add Raster Layer Dialog

  2. Check radioButtonOn File source type

  3. Click on the Browse button

  4. Navigate the file system and load a supported data source. More than one layer can be loaded at the same time by holding down the Ctrl key and clicking on multiple items in the dialog or holding down the Shift key to select a range of items by clicking on the first and last items in the range. Only formats that have been well tested appear in the formats filter. Other formats can be loaded by selecting All files (the top item in the pull-down menu).

  5. Press Open to load the selected file into Data Source Manager dialog.

    Depending on the selected layer type, additional Options (encoding, geometry type, table filtering, file locking, data formatting …) are available for configuring. These options are described in detail in the specific GDAL vector or raster driver documentation. At the top of the options, a text with hyperlink will directly lead to the documentation of the appopriate driver for the selected file format.

    ../../../_images/openoptionsvectorlayer.png

    Fig. 15.6 Loading a Shapefile with open options

  6. Press Add to load the file in QGIS and display them in the map view. When adding vector datasets containing multiple layers, the Select Items to Add dialog will appear. In this dialog, you can choose the specific layers from your dataset that you want to add. Also, under Options you can choose to:

    • checkboxAdd layers to a group

    • checkboxShow system and internal tables

    • checkboxShow empty vector layers.

    Fig. 15.7 shows QGIS after loading the alaska.shp file.

    ../../../_images/shapefileloaded.png

    Fig. 15.7 QGIS with Shapefile of Alaska loaded

Note

Because some formats like MapInfo (e.g., .tab) or Autocad (.dxf) allow mixing different types of geometry in a single file, loading such datasets opens a dialog to select geometries to use in order to have one geometry per layer.

The addOgrLayer Add Vector Layer and addRasterLayer Add Raster Layer tabs allow loading of layers from source types other than File:

  • You can load specific vector formats like ArcInfo Binary Coverage, UK. National Transfer Format, as well as the raw TIGER format of the US Census Bureau or OpenfileGDB. To do that, you select radioButtonOn Directory as Source type. In this case, a directory can be selected in the dialog after pressing Browse.

  • With the radioButtonOn Database source type you can select an existing database connection or create one to the selected database type. Some possible database types are ODBC, Esri Personal Geodatabase, MS SQL Server as well as PostgreSQL or MySQL .

    Pressing the New button opens the Create a New OGR Database Connection dialog whose parameters are among the ones you can find in Creating a stored Connection. Pressing Open lets you select from the available tables, for example of PostGIS enabled databases.

  • The radioButtonOn Protocol: HTTP(S), cloud, etc. source type opens data stored locally or on the network, either publicly accessible, or in private buckets of commercial cloud storage services. Supported protocol types are:

    • HTTP/HTTPS/FTP, with a URI and, if required, an authentication.

    • Cloud storage such as AWS S3, Google Cloud Storage, Microsoft Azure Blob, Alibaba OSS Cloud, Open Stack Swift Storage. You need to fill in the Bucket or container and the Object key.

    • service supporting OGC WFS 3 (still experimental), using GeoJSON or GEOJSON - Newline Delimited format or based on CouchDB database. A URI is required, with optional authentication.

    • For all vector source types it is possible to define the Encoding or to use the Automatic ► setting.

  • The radioButtonOn OGC API source type allows you to access vector and raster data from servers that implement the OGC API standards. To use this option:

    1. Select radioButtonOn OGC API from the Data Source Manager dialog.

    2. Enter the endpoint of the OGC API service you want to connect to. Note that you don’t need to prefix the endpoint with “OGCAPI:”.

    3. Click Connect to establish a connection to the server.

15.1.3.2. Loading a mesh layer

A mesh is an unstructured grid usually with temporal and other components. The spatial component contains a collection of vertices, edges and faces in 2D or 3D space. More information on mesh layers at Working with Mesh Data.

To add a mesh layer to QGIS:

  1. Open the Data Source Manager dialog, either by selecting it from the Layer ► menu or clicking the dataSourceManager Open Data Source Manager button.

  2. Enable the addMeshLayer Mesh tab on the left panel

  3. Press the Browse button to select the file. Various formats are supported.

  4. Select the file and press Add. The layer will be added using the native mesh rendering.

  5. If the selected file contains many mesh layers, then you’ll be prompted with a dialog to choose the sublayers to load. Do your selection and press OK and the layers are loaded with the native mesh rendering. It’s also possible to load them within a group.

../../../_images/mesh_datasource_manager.png

Fig. 15.8 Mesh tab in Data Source Manager

15.1.3.3. Importing a delimited text file

Delimited text files (e.g. .txt, .csv, .dat, .wkt) can be loaded using the tools described above. This way, they will show up as simple tables. Sometimes, delimited text files can contain coordinates / geometries that you could want to visualize. This is what addDelimitedTextLayerAdd Delimited Text Layer is designed for.

  1. Click the dataSourceManager Open Data Source Manager icon to open the Data Source Manager dialog

  2. Enable the addDelimitedTextLayer Delimited Text tab

  3. Select the delimited text file to import (e.g., qgis_sample_data/csv/elevp.csv) by clicking on the Browse button.

  4. In the Layer name field, provide the name to use for the layer in the project (e.g. Elevation).

  5. Configure the settings to meet your dataset and needs, as explained below.

../../../_images/delimited_text_dialog.png

Fig. 15.9 Delimited Text Dialog

File format

Once the file is selected, QGIS attempts to parse the file with the most recently used delimiter, identifying fields and rows. To enable QGIS to correctly parse the file, it is important to select the right delimiter. You can specify a delimiter by choosing between:

  • radioButtonOnCSV (comma separated values) to use the comma character.

  • radioButtonOffRegular expression delimiter and enter text into the Expression field. For example, to change the delimiter to tab, use \t (this is used in regular expressions for the tab character).

  • radioButtonOffCustom delimiters, choosing among some predefined delimiters like comma, space, tab, semicolon, … .

Records and fields

Some other convenient options can be used for data recognition:

  • Number of header lines to discard: convenient when you want to avoid the first lines in the file in the import, either because those are blank lines or with another formatting.

  • checkboxFirst record has field names: values in the first line are used as field names, otherwise QGIS uses the field names field_1, field_2

  • checkboxDetect field types: automatically recognizes the field type. If unchecked then all attributes are treated as text fields.

  • checkboxDecimal separator is comma: you can force decimal separator to be a comma.

  • checkboxTrim fields: allows you to trim leading and trailing spaces from fields.

  • checkboxDiscard empty fields.

  • Custom boolean literals: allows you to add a custom couple of string that will be detected as boolean values.

Field type detection

QGIS tries to detect the field types automatically (unless checkboxDetect field types is not checked) by examining the content of an optional sidecar CSVT file (see: GeoCSV specification) and by scanning the whole file to make sure that all values can actually be converted without errors, the fall-back field type is text.

The detected field type appears under the field name in sample data preview table and can be manually changed if necessary.

The following field types are supported:

  • Boolean case-insensitive literal couples that are interpreted as boolean values are 1/0, true/false, t/f, yes/no

  • Whole Number (integer)

  • Whole Number (integer - 64 bit)

  • Decimal Number: double precision floating point number

  • Date

  • Time

  • Date and Time

  • Text

Geometry definition

Once the file is parsed, set Geometry definition to

  • radioButtonOnPoint coordinates and provide the X field, Y field, Z field (for 3-dimensional data) and M field (for the measurement dimension) if the layer is of point geometry type and contains such fields. If the coordinates are defined as degrees/minutes/seconds, activate the checkboxDMS coordinates checkbox. Provide the appropriate Geometry CRS using the setProjection Select CRS widget.

  • radioButtonOnWell known text (WKT) option if the spatial information is represented as WKT: select the Geometry field containing the WKT geometry and choose the approriate Geometry field or let QGIS auto-detect it. Provide the appropriate Geometry CRS using the setProjection Select CRS widget.

  • If the file contains non-spatial data, activate radioButtonOn No geometry (attribute only table) and it will be loaded as an ordinary table.

Layer settings

Additionally, you can enable:

  • checkboxUse spatial index to improve the performance of displaying and spatially selecting features.

  • checkboxUse subset index to improve performance of subset filters (when defined in the layer properties).

  • checkboxWatch file to watch for changes to the file by other applications while QGIS is running.

At the end, click Add to add the layer to the map. In our example, a point layer named Elevation is added to the project and behaves like any other map layer in QGIS. This layer is the result of a query on the .csv source file (hence, linked to it) and would require to be saved in order to get a spatial layer on disk.

Sample Data

As you set the parser properties, the sample data preview updates regarding to the applied settings.

Also in the Sample Data Table it is possible to override the automatically determined column types.

15.1.3.4. Importing a DXF or DWG file

DXF and DWG files can be added to QGIS by simple drag-and-drop from the Browser Panel. You will be prompted to select the sublayers you would like to add to the project. Layers are added with random style properties.

Note

For DXF files containing several geometry types (point, line and/or polygon), the name of the layers will be generated as <filename.dxf> entities <geometry type>.

To keep the dxf/dwg file structure and its symbology in QGIS, you may want to use the dedicated Project ► Import/Export ► Import Layers from DWG/DXF… tool which allows you to:

  1. import elements from the drawing file into a GeoPackage database.

  2. add imported elements to the project.

In the DWG/DXF Import dialog, to import the drawing file contents:

  1. Input the location of the Source drawing, i.e. the DWG/DXF drawing file to import.

  2. Specify the coordinate reference system of the data in the drawing file.

  3. Input the location of the Target package, i.e. the GeoPackage file that will store the data. If an existing file is provided, then it will be overwritten.

  4. Choose how to import blocks with the dedicated combobox:

    • Expand Block Geometries: imports the blocks in the drawing file as normal elements.

    • Expand Block Geometries and Add Insert Points: imports the blocks in the drawing file as normal elements and adds the insertion point as a point layer.

    • Add Only Insert Points: adds the blocks insertion point as a point layer.

  5. Check checkbox Use curves to promote the imported layers to a curved geometry type.

  6. Use the Import button to import the drawing into the destination GeoPackage file. The GeoPackage database will be automatically populated with the drawing file content. Depending on the size of the file, this can take some time.

After the .dwg or .dxf data has been imported into the GeoPackage database, the frame in the lower half of the dialog is populated with the list of layers from the imported file. There you can select which layers to add to the QGIS project:

  1. At the top, set a Group name to group the drawing files in the project. By default this is set to the filename of the source drawing file.

  2. Check layers to show: Each selected layer is added to an ad hoc group which contains vector layers for the point, line, label and area features of the drawing layer. The style of the layers will resemble the look they originally had in *CAD.

  3. Choose if the layer should be visible at opening.

  4. Checking the checkbox Merge layers option places all layers in a single group.

  5. Press OK to open the layers in QGIS.

../../../_images/dwg_dxf_import_dialog.png

Fig. 15.10 Import dialog for DWG/DXF files

15.1.3.5. Importing OpenStreetMap Vectors

The OpenStreetMap project is popular because in many countries no free geodata such as digital road maps are available. The objective of the OSM project is to create a free editable map of the world from GPS data, aerial photography and local knowledge. To support this objective, QGIS provides support for OSM data.

Using the Browser Panel, you can load an .osm file to the map canvas, in which case you’ll get a dialog to select sublayers based on the geometry type. The loaded layers will contain all the data of that geometry type in the .osm file, and keep the osm file data structure.

15.1.3.6. SpatiaLite Layers

addSpatiaLiteLayer The first time you load data from a SpatiaLite database, begin by:

  • clicking on the addSpatiaLiteLayer Add SpatiaLite Layer toolbar button

  • selecting the addSpatiaLiteLayer Add SpatiaLite Layer… option from the Layer ► Add Layer menu

  • or by typing Ctrl+Shift+L

This will bring up a window that will allow you either to connect to a SpatiaLite database already known to QGIS (which you choose from the drop-down menu) or to define a new connection to a new database. To define a new connection, click on New and use the file browser to point to your SpatiaLite database, which is a file with a .sqlite extension.

QGIS also supports editable views in SpatiaLite.

15.1.3.7. GPS

There are dozens of different file formats for storing GPS data. The format that QGIS uses is called GPX (GPS eXchange format), which is a standard interchange format that can contain any number of waypoints, routes and tracks in the same file.

Use the Browse button to select the GPX file, then use the check boxes to select the feature types you want to load from that GPX file. Each feature type will be loaded in a separate layer.

More on GPS data manipulation at Working with GPS Data.

../../../_images/gps_datasource.png

Fig. 15.11 Loading GPS Data dialog

15.1.3.8. GRASS

Working with GRASS vector data is described in section GRASS GIS Integration.

15.1.4. The Layer Metadata Search Panel

By default, QGIS can retrieve layers metadata from the connections or data providers that allow metadata storage (more details on saving metadata to the database). The Metadata search panel allows to browse the layers by their metadata and add them to the project (either with a double-click or the Add button). The list can be filtered:

  • by text, watching a set of metadata properties (identifier, title, abstract)

  • by spatial extent, using the current project extent or the map canvas extent

  • by the layer (geometry) type

Note

The sources of metadata are implemented through a layer metadata provider system that can be extended by plugins.

../../../_images/layer_metadata_search_panel.png

Fig. 15.16 Layer Metadata Search Panel

15.1.5. QGIS Custom formats

QGIS proposes two custom formats:

15.1.6. QLR - QGIS Layer Definition File

Layer definitions can be saved as a Layer Definition File (QLR - .qlr) using Export ► Save As Layer Definition File… in the layer context menu.

The QLR format makes it possible to share “complete” QGIS layers with other QGIS users. QLR files contain links to the data sources and all the QGIS style information necessary to style the layer.

QLR files are shown in the Browser Panel and can be used to add layers (with their saved styles) to the Layers Panel. You can also drag and drop QLR files from the system file manager into the map canvas.

15.1.7. Connecting to web services

With QGIS you can get access to different types of OGC web services (WM(T)S, WFS(-T), WCS, CSW, …). Thanks to QGIS Server, you can also publish such services. QGIS Server Guide/Manual contains descriptions of these capabilities.

15.1.7.1. Using Vector Tiles services

Vector Tile services can be added via the addVectorTileLayer Vector Tiles tab of the Data Source Manager dialog or the contextual menu of the Vector Tiles entry in the Browser panel. Services can be either a New Generic Connection… or a New ArcGIS Vector Tile Service Connection….

You set up a service by adding:

  • a Name

  • a Style URL: a URL to a MapBox GL JSON style configuration. If provided, then that style will be applied whenever the layers from the connection are added to QGIS. In the case of Arcgis vector tile service connections, the URL overrides the default style configuration specified in the server configuration.

    You can load vector tiles directly from a Style URL. The data source is automatically parsed from the style, and URLs with multiple sources are supported. That makes Source URL optional.

  • the Source URL: of the type http://example.com/{z}/{x}/{y}.pbf for generic services and http://example.com/arcgis/rest/services/Layer/VectorTileServer for ArcGIS based services. The service must provide tiles in .pbf format.

  • the checkboxMin. Zoom Level and the checkboxMax. Zoom Level. Vector Tiles have a pyramid structure. By using these options you have the opportunity to individually generate layers from the tile pyramid. These layers will then be used to render the Vector Tile in QGIS.

    For Mercator projection (used by OpenStreetMap Vector Tiles) Zoom Level 0 represents the whole world at a scale of 1:500.000.000. Zoom Level 14 represents the scale 1:35.000.

  • the authentication configuration if necessary

  • a Referer

Fig. 15.17 shows the dialog with the Vector Tiles service configuration.

../../../_images/vector_tiles_configuration.png

Fig. 15.17 Vector Tiles - Service configuration

Configurations can be saved to .XML file (Save Connections) through the Vector Tiles entry in Data Source Manager dialog or its context menu in the Browser panel. Likewise, they can be added from a file (Load Connections).

Once a connection to a vector tile service is set, it’s possible to:

  • Edit the vector tile connection settings

  • Remove the connection

  • From the Browser panel, right-click over the entry and you can also:

    • Add layer to project: a double-click also adds the layer

    • View the Layer Properties… and get access to metadata and a preview of the data provided by the service. More settings are available when the layer has been loaded into the project.

15.1.7.2. Using XYZ Tile services

XYZ Tile services can be added via the addXyzLayer XYZ tab of the Data Source Manager dialog or the contextual menu of the XYZ Tiles entry in the Browser panel. By default, QGIS provides some default and ready-to-use XYZ Tiles services:

  • xyz Mapzen Global Terrain, allowing an immediate access to global DEM source for the projects. More details and resources at https://registry.opendata.aws/terrain-tiles/

  • xyz OpenStreetMap to access the world 2D map. Fig. 15.18 shows the dialog with the OpenStreetMap XYZ Tile service configuration.

To add a new service, press New (respectively New Connection from the Browser panel) and provide:

../../../_images/xyz_tiles_dialog_osm.png

Fig. 15.18 XYZ Tiles - OpenStreetMap configuration

  • a Name

  • the URL, you can add http://example.com/{z}/{x}/{y}.png or file:///local_path/{z}/{x}/{y}.png

  • the authentication configuration if necessary

  • the Min. Zoom level and Max. Zoom level

  • a Referer

  • the Tile Resolution: possible values are Unknown (not scaled), Standard (256x256 / 96DPI) and High (512x512 / 192DPI)

  • Interpretation: converts WMTS/XYZ raster datasets to a raster layer of single band float type following a predefined encoding scheme. Supported schemes are Default (no conversion is done), MapTiler Terrain RGB and Terrarium Terrain RGB. The selected converter will translate the RGB source values to float values for each pixel. Once loaded, the layer will be presented as a single band floating point raster layer, ready for styling using QGIS usual raster renderers.

Press OK to establish the connection. It will then be possible to:

  • Add the new layer to the project; it is loaded with the name given in the settings.

  • Edit the XYZ connection settings

  • Remove the connection

  • From the Browser panel, right-click over the entry and you can also:

    • Export layer… ► To File, saving it as a raster

    • Add layer to project: a double-click also adds the layer

    • View the Layer Properties… and get access to metadata and a preview of the data provided by the service. More settings are available when the layer has been loaded into the project.

Configurations can be saved to .XML file (Save Connections) through the XYZ entry in Data Source Manager dialog or its contextual menu in the Browser panel. Likewise, they can be added from a file (Load Connections).

The XML file for OpenStreetMap looks like this:

<!DOCTYPE connections>
<qgsXYZTilesConnections version="1.0">
  <xyztiles url="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
   zmin="0" zmax="19" tilePixelRatio="0" password="" name="OpenStreetMap"
   username="" authcfg="" referer=""/>
</qgsXYZTilesConnections>

Tip

Loading XYZ tiles without creating a connection

It is also possible to add XYZ tiles to a project without necessarily storing its connection settings in you user profile (e.g. for a dataset you may need once). In the Data Source Manager ► XYZ tab, edit any properties in the Connection Details group. The Name field above should turn into Custom. Press Add to load the layer in the project. It will be named by default XYZ Layer.

Examples of XYZ Tile services:

  • OpenStreetMap Monochrome: URL: http://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png, Min. Zoom Level: 0, Max. Zoom Level: 19.

  • Google Maps: URL: https://mt1.google.com/vt/lyrs=m&x={x}&y={y}&z={z}, Min. Zoom Level: 0, Max. Zoom Level: 19.

  • Open Weather Map Temperature: URL: http://tile.openweathermap.org/map/temp_new/{z}/{x}/{y}.png?appid={api_key} Min. Zoom Level: 0, Max. Zoom Level: 19.

15.1.7.3. Using ArcGIS REST Servers

ArcGIS REST Servers can be added via the addAfsLayer ArcGIS REST Server tab of the Data Source Manager dialog or the contextual menu of the ArcGIS REST Servers entry in the Browser panel. Press New (respectively New Connection) and provide:

  • a Name

  • the URL

  • a Prefix: This is used to specify the proxy prefix in the URL, which is necessary for some ArcGIS servers that use web proxy prefixes.

  • a Community endpoint URL

  • a Content endpoint URL

  • the authentication configuration if necessary

  • a Referer

Note

ArcGIS Feature Service connections which have their corresponding Portal endpoint URLS set can be explored by content groups in the browser panel.

If a connection has the Portal endpoints set, then expanding out the connection in the browser will show a “Groups” and “Services” folder, instead of the full list of services usually shown. Expanding out the groups folder will show a list of all content groups that the user is a member of, each of which can be expanded to show the service items belonging to that group.

Configurations can be saved to .XML file (Save Connections) through the ArcGIS REST Server entry in Data Source Manager dialog. Likewise, they can be added from a file (Load Connections).

Once a connection to an ArcGIS REST Server is set, it’s possible to:

  • Edit the ArcGIS REST Server connection settings

  • Remove the connection

  • Refresh the connection

  • use a filter for the available layers

  • choose from a list of available layers with the option to checkboxOnly request features overlapping the current view extent

  • From the Browser panel, right-click over the connection entry and you can:

    • Refresh

    • Edit connection…

    • Remove connection…

    • View Service Info which will open the default web browser and display the Service Info.

  • Right-click over the layer entry and you can also:

    • View Service Info which will open the default web browser and display the Service Info.

    • Export layer… ► To File

    • Add layer to project: a double-click also adds the layer

    • View the Layer Properties… and get access to metadata and a preview of the data provided by the service. More settings are available when the layer has been loaded into the project.

15.1.7.4. Using 3D tiled scene services

QGIS supports multiple formats of 3D tiled datasets, grouped together as “tiled scenes”. These include Cesium 3D Tiles and Quantized Mesh tiles.

To load a tiled scene dataset into QGIS, use the addTiledSceneLayer Scene tab in the Data Source Manager dialog.

../../../_images/scene.png

Fig. 15.19 Data Source Manager - Scene

Create a connection by clicking on New. You can add a New Cesium 3D Tiles Connection or a New Quantized Mesh Connection.

Choose a Name and set the URL to the URL of a layer description JSON file.

The URL may be remote (e.g. http://example.com/tileset.json) or local (e.g. file:///path/to/tiles/tileset.json).

../../../_images/tiled_scene_connection.png

Fig. 15.20 Tiled Scene Connection

You can also add the service from Browser Panel.

After creating new connection you are able to Add the new layer to your map.

../../../_images/3d_tiles_layer.png

Fig. 15.21 3D Tiles Layer - Textured

../../../_images/quantized_mesh_layer.png

Fig. 15.22 Quantized Mesh layer

15.1.7.5. Using Cloud Connections

QGIS supports connections to cloud services like Alibaba Cloud OSS, Amazon S3, Google Cloud Storage, Microsoft Azure Blob Storage, Microsoft Azure Data Lake Storage, and OpenStack Swift Object Storage. You can load vector and raster data from these services into QGIS. Set up a new cloud Cloud connection in the Browser panel by right-clicking on the Cloud entry and selecting New Connection. You will see a drop-down list of available cloud services. Select the service you want to connect to and fill in the required fields:

../../../_images/cloud_connection.png

Fig. 15.23 Cloud Connection Dialog

  • Name: A name for the connection.

  • Bucket or Container: The name of the bucket or container in the cloud service.

  • Object Key (optional): The key of the object in the bucket or container.

  • Credentials: The credentials to access the cloud service.

You can also choose to Save Connection to an XML file or Load Connection from an XML file.