` `

Ouverture des données

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 comme client de données OGC);
  • 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.

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

Note

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 Actualiser l’arborescence

  • 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:
    • ormal : renvoie tous les éléments qui contiennent la chaîne de texte cherchée

    • joker : optimise la recherche en utilisant les caractères ? et/ou * pour spécifier la position de la chaîne recherchée

    • expression régulière

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

Faire un clic-droit sur un élément de l’arborescence vous permez de :

  • Dans le cas d’un fichier ou une table, afficher les métadonnées ou l’ouvrir dans votre projet. Les tables peuvent également être renommées, supprimées ou tronquées.

  • Dans le cas d’un répertoire, l’ajouter aux favoris, le masquer de l’arborescence de l’Explorateur. La liste des répertoires masqués se gère dans Préférences ‣ Options ‣ Sources de données.

  • create connection to databases or web servers;
  • actualiser, renommer ou supprimer un schéma de base de données.

Vous pouvez également importer des fichiers dans les bases de données ou copier des tables d’un schéma / d’une base à une autre via un glisser-déposer. Vous pouvez afficher un deuxième panneau Explorateur pour faciliter les manipulations. Sélectionnez juste le fichier et déplacez-le d’un panneau à l’autre.

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

Les deux panneaux de l’Explorateur QGIS côte à côte

Astuce

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 Extension DB Manager.

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

Fenêtre DB Manager

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.

Note

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

Charger une couche à partir d’un fichier

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

    Fenêtre d’ajout d’une couche vectorielle

  • 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

Fenêtre d’ouverture de données vectorielles dont le format est géré par OGR

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 après avoir chargé le Shapefile de l’Alaska

Note

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 Créer une connexion enregistrée. 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.

Astuce

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

Fenêtre d’ajout de couche depuis un fichier texte délimité

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.

En complément, vous pouvez activer :

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

Note

Les fichiers DXF contiennent généralement plusieurs types géométriques (point, ligne et/ou polygone), le nom de la couche sera basé sur <nom_de_fichier.dxf> entities <type géométrique>.

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.

Importer des données vecteur OpenStreetMap

Ces dernières années, le projet OpenStreetMap (OSM) a gagné en popularité, car dans beaucoup de pays, aucune donnée géographique sous licence libre, telle que par exemple le réseau routier, n’est disponible. L’objectif du projet OSM est de créer une base de données géographiques libre sur le monde entier et qui est éditable par tous à partir de données GPS, de photographies aériennes ou tout simplement des connaissances locales du terrain. Pour soutenir ce projet, QGIS fournit une extension qui permet aux utilisateurs de travailler avec les données OSM.

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 Couches SpatiaLite).

GPS

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

GRASS

Le travail sur des couches vectorielles GRASS est décrit dans la Section Intégration du SIG GRASS.

Couches SpatiaLite

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 gère les vues SpatiaLite éditables.

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 Les données OGC.