QGIS 2 Cookbook
上QQ阅读APP看书,第一时间看更新

Describing data sources

You can get additional information about a data file before opening it. This recipe shows you how to explore the properties of a data origin.

Getting ready

Before you start working, make sure that you have copied the sample dataset to your filesystem and that you have it located.

How to do it…

  1. In the QGIS browser, navigate to the folder with your sample dataset. Select the elev_lid792_1m file and right-click on it. In the context menu, select Properties. A dialog like the one in the following screenshot will appear:
    How to do it…

    This dialog displays the properties of a raster layer.

  2. Now, let's select a vector layer instead. Select the elev_lid792_randpts.shp file, right-click on it, and select Properties. The information dialog will look like the following:
    How to do it…

How it works…

In the upper part of the description window, you will see a field named Provider. Provider defines the type or data origin and who takes care of reading the data and passing it to QGIS. For raster layers, you will see gdal as Provider. For most file-based vector layers, ogr will be the provider that will appear. They refer to the GDAL and OGR libraries, two open-source libraries that are used by many GIS programs to access both raster and vector data.

There's more…

If the data is already loaded in QGIS, you can access the information about it in the Properties section of the layer (right-click on the layer name to select the Properties entry in the context menu). In the sections displayed in the left-hand side, select the Metadata section. You will see a box containing all the information corresponding to the layer data origin:

There's more…

Functionality provided by the GDAL library, which (mentioned earlier) acts as a provider for raster layers, is also available in the Raster menu. This includes processing and data analysis methods, but it also includes the information tool that is used to describe a raster data source. You will find it by navigating to Raster | Miscellaneous | Info:

There's more…

See also

  • This is a more complex way to retrieve properties as you can call the tool by adjusting the parameters with more details to get additional information. To know more, check the gdalinfo help page at http://www.gdal.org/gdalinfo.html.