Outdated version of the documentation. Find the latest one here.

` `

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 ESRI formats (shapefiles, geodatabases...), MapInfo and MicroStation file formats, AutoCAD DWG/DXF, GeoPackage, GeoJSON, GRASS, GPX, KML, Comma Separated Values, and many more... Read the complete list of OGR vector supported formats;
  • Raster data formats include ArcInfo Binary Grid, ArcInfo ASCII Grid, JPEG, GeoTIFF, ERDAS IMAGINE, MBTiles, R or Idrisi rasters, ASCII Gridded XYZ, GDAL Virtual, SRTM, Sentinel Data, and many more... Read the complete list of raster supported formats;
  • Database formats include PostgreSQL/PostGIS, SQLite/SpatiaLite, Oracle, DB2 or MSSQL Spatial, MySQL...;
  • Support of web data services (WM(T)S, WFS, WCS, CSW, ArcGIS Servers...) is also handled by QGIS providers (see QGIS als OGC Datenclient);
  • You can also read supported files from archived folders and use QGIS native formats such as virtual and memory layers.

As of the date of this document, more than 80 vector and 140 raster formats are supported by the GDAL/OGR and QGIS native providers.

Bemerkung

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 have a list of available formats, run the command line ogrinfo --formats (for vector) or check settings ‣ Options ‣ GDAL menu (for raster) in QGIS.

The Browser Panel

QGIS Browser is one of the main panels of QGIS that lets you quickly and easily add your data to projects. It helps you navigate in your filesystem and manage geodata, regardless the type of layer (raster, vector, table), or the datasource format (plain or compressed files, database, web services).

To add a layer into a project:

  1. right-click on QGIS toolbar and check checkbox Browser Panel to activate it or select it from the menu View ‣ Panels (or kde Settings ‣ Panels);
  2. a browser tree with your filesystem, databases and web services is displayed;
  3. find the layer in the list;
  4. right-click on its name and select Add selected layer(s). Your layer is now added to the Layers Panel and can be viewed in the map canvas.

Bemerkung

You can also add a layer or 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 Style Properties for more information on setting symbology of vector layers.

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

  • addLayer Add Selected Layers: you can also add data into the map canvas by selecting Add selected layer(s) from the layer’s context menu;
  • draw 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 on the figure_browser_panels. The comparison can be case-sensitive or not. It can also be set to:
    • normal: return any item containing the search text;
    • using wildcard(s): fine tune the search using ? and/or * characters to specify the position of the search text;
    • using a regular expression.
  • collapseTree Collapse All the whole tree;
  • propertiesWidget Enable/disable properties widget: when toggled on, a new widget is added at the bottom of the panel showing, if applicable, metadatas of the selected item.

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

  • in case of file or table, display its metadata or open it in your project. Tables can even be renamed, deleted or truncated;
  • in case of folder, bookmark it into your favourites, hide it from the browser tree. Hidden folders can be managed from the Settings ‣ Options ‣ Data Sources tab;
  • create connection to databases or web servers;
  • refresh, rename or delete schema.

You can also import files into databases or copy tables from one schema/database to another one 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

QGIS Browser panels side-by-side

Tipp

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.

The DB Manager

The DB Manager Plugin is another one of the main and native tools to integrate and manage spatial database formats supported by QGIS (PostGIS, SpatiaLite, GeoPackage, Oracle Spatial, MSSQL, DB2, Virtual layers) in one user interface. 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 its structure and contents;
  • preview tables of databases;
  • add layers to map canvas, either by double-click or drag-and-drop;
  • add layers to a database from the QGIS Browser or from another database;
  • create and add output of SQL queries to the map canvas;
  • create virtual layers.

More information on DB Manager capabilities are exposed in DB Manager Plugin.

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

DB Manager dialog

Provider-based loading tools

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

Bemerkung

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

Loading a layer from a file

To load a layer from a file, you can:

  • for vector data (like Shapefile, Mapinfo or dxf layer), click on addOgrLayer Add Vector Layer toolbar button, select the Layer ‣ Add Layer ‣ addOgrLayerAdd Vector Layer menu option or press Ctrl+Shift+V. This will bring up a new window (see figure_vector_add) from which you can check radioButtonOn File and click on [Browse]. You can also specify the encoding for the file if desired.

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

    Add Vector Layer Dialog

  • for raster layers, click on the addRasterLayer Add Raster Layer icon, select the Layer ‣ Add Layer ‣ addRasterLayer Add Raster Layer menu option or type Ctrl+Shift+R.

That will bring up a standard open file dialog (see figure_vector_open), which allows you to navigate the file system and load a shapefile, a geotiff or other supported data source. The selection box Filter selectString allows you to preselect some supported file formats. Only the formats that have been well tested appear in the list. Other untested formats can be loaded by selecting All files (*.*).

../../../_images/shapefileopendialog.png

Open an OGR Supported Vector Layer Dialog

Selecting a file from the list and clicking [Open] loads it into QGIS. More than one layer can be loaded at the same time by holding down the Ctrl or Shift key and clicking on multiple items in the dialog. Figure_vector_loaded shows QGIS after loading the alaska.shp file.

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

QGIS with Shapefile of Alaska loaded

Bemerkung

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

Using the addOgrLayer Add Vector Layer tool:

  • You can also load specific 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’d need to 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. Available database types are ODBC, OGDI Vectors, Esri Personal Geodatabase, MySQL as well as PostgreSQL or MSSQL.

    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] you can select from the available tables for example of the PostGIS enabled database.

  • The last source type, radioButtonOn Protocol, enables to open data from the web using for example GeoJSON or CouchDB format. After selecting the type you have to fill URI of the source.

Tipp

Load layers and projects from mounted external drives on macOS

On macOS, portable drives that are mounted beside the primary hard drive do not show up as expected under File ‣ Open Project. We are working on a more macOS-native open/save dialog to fix this. As a workaround, you can type /Volumes in the File name box and press Enter. Then you can navigate to external drives and network mounts.

Importing a delimited text file

Delimited text file (e.g. .csv, .txt) can be loaded in QGIS using the tools described above. However, loaded this way, it’ll show up like a simple table data. Sometimes, delimited text files can contain geometric data you’d want to visualize; this is what the delimitedText Add Delimited Text Layer is designed for.

Click the toolbar icon delimitedText Add Delimited Text Layer in the Manage layers toolbar to open the Create a Layer from a Delimited Text File dialog, as shown in figure_delimited_text.

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

Delimited Text Dialog

First, select the file to import (e.g., qgis_sample_data/csv/elevp.csv) by clicking on the [Browse] button. Once the file is selected, QGIS attempts to parse the file with the most recently used delimiter. To enable QGIS to properly parse the file, it is important to select the correct delimiter. You can specify a delimiter by activating:

  • radioButtonOnCSV (comma separated values);
  • radioButtonOffCustom delimiters, choosing among some predefined delimiters like comma, space, tab, semicolon...;
  • or radioButtonOffRegular expression delimiter and entering text into the Expression field. For example, to change the delimiter to tab, use \t (this is a regular expression for the tab character).

Once the file is parsed, set Geometry definition to radioButtonOnPoint coordinates and choose the X and Y fields from the dropdown lists. If the coordinates are defined as degrees/minutes/seconds, activate the checkbox DMS coordinates checkbox.

Finally, enter a layer name (e.g., elevp), as shown in figure_delimited_text. To add the layer to the map, click [OK]. The delimited text file now behaves as any other map layer in QGIS.

There is also a helper option that allows you to trim leading and trailing spaces from fields — checkbox Trim fields. Also, it is possible to checkbox Discard empty fields. If necessary, you can force a comma to be the decimal separator by activating checkbox Decimal separator is comma.

If spatial information is represented by WKT, activate the radioButtonOn Well Known Text option and select the field with the WKT definition for point, line or polygon objects. If the file contains non-spatial data, activate radioButtonOn No geometry (attribute only table) and it will be loaded as an ordinal table.

Additionally, you can enable:

  • checkbox Use spatial index to improve the performance of displaying and spatially selecting features;
  • checkbox Use subset index;
  • checkbox Watch file to watch for changes to the file by other applications while QGIS is running.

Importing a DXF or DWG file

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

Bemerkung

DXF files containing several geometry types (point, line and/or polygon), the name of the layer will be made from <filename.dxf> entities <geometry type>.

To keep the dxf/dwg structure and its symbology in QGIS, you may want to use the dedicated Project ‣ DWG/DXF Import... tool. Indeed, the DWG/DXF Import dialog allows you to import into GeoPackage database any element of the drawing file.

In the dialog, you have to:

  • Input a location for a GeoPackage file, that will be created to store the DWG/DXF content to;
  • Specify which coordinate system the data in the DWG data is in;
  • Then use the [Import] button to select the DWG/DXF file to use (one per geopackage). The GeoPackage database will be automatically populated with the drawing file content. Depending on the size of the *CAD file, this could take some time;
  • The checkbox Expand block references will transform the existing blocks into normal elements;
  • the checkbox Use curves promotes the output layers geometry type to a curved one.

After the .dwg or .dxf data is 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:

  • At the top, set a Group name to group the drawing files in the project;
  • 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 each layer is setup so that it resembles the look it originally had in *CAD;
  • Check whether layer should be visible at opening;
  • Alternatively using the checkbox Merge layers option places all layers in a single group;
  • Press [OK] to open the layers in QGIS.

Importing OpenStreetMap Vectors

In recent years, the OpenStreetMap project has gained popularity 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 or local knowledge. To support this objective, QGIS provides support for OSM data.

Using the Browser Panel, you can load a .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 file and keep the osm file data structure.

To avoid working with a such complex data structure, and be able to select only features you need based on their tags, QGIS provides a core and fully integrated OpenStreetMap import tool:

  • To connect to the OSM server and download data, open the menu Vector ‣ OpenStreetMap ‣ Download data.... You can skip this step if you already obtained an .osm XML file using JOSM, Overpass API or any other source;
  • The menu Vector ‣ OpenStreetMap ‣ Import Topology from XML... will convert your .osm file into a SpatiaLite database and create a corresponding database connection;
  • The menu Vector ‣ OpenStreetMap ‣ Export Topology to SpatiaLite... then allows you to open the database connection, select the type of data you want (points, lines, or polygons) and choose tags to import. This creates a SpatiaLite geometry layer that you can add to your project by clicking on the addSpatiaLiteLayer Add SpatiaLite Layer toolbar button or by selecting the addSpatiaLiteLayer Add SpatiaLite Layer... option from the Layer menu (see section SpatiaLite Layers).

GPS

Loading GPS data in QGIS can be done using the core plugin: GPS Tools. Instructions are described in Section GPS Plugin.

GRASS

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

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 can 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.

QGIS Custom formats

QGIS proposes two custom formats you can load in the application using their own loading tool:

Connecting to web services

With QGIS you can have access to different types of OGC web services (WM(T)S, WFS(-T), CSW ...). Thanks to QGIS Server, you can also publish these services. Description of these capabilities and how-to are provided in chapter Arbeiten mit OGC Daten.