7. Frequently Asked Questions

If you have comments or questions please join the Facebook group or the Google+ Community .

Before asking, please check the official site From GIS to Remote Sensing and the following Frequently Asked Questions.

7.1. Plugin installation

7.1.1. How to install the plugin manually?

The SCP can be installed manually (this can be useful when an internet connection is not available, or the installation is required on multiple computers), following a few steps:

  1. download the SCP zip archive from https://github.com/semiautomaticgit/SemiAutomaticClassificationPlugin/archive/master.zip ;
  2. extract the content of the archive (several files such as COPYING.txt and folders such as ui) in a new folder named SemiAutomaticClassificationPlugin (without -master);
  3. open the QGIS plugins directory (in Windows usually C:\Users\username\.qgis2\python\plugins, in Linux and Mac usually /home/username/.qgis2/python/plugins/) and delete the folder SemiAutomaticClassificationPlugin if present;
  4. copy the folder SemiAutomaticClassificationPlugin inside the QGIS plugins directory;
  5. the plugin should be installed; start QGIS, open the Plugin Manager and be sure that Semi-Automatic Classification Plugin is checked.

7.1.2. How to install the plugin from the official SCP repository?

It is possible to install the SCP using the official repository. This repository allows for the installation of the latest version of SCP (master), in some cases also before the availability thereof in the QGIS repository. Therefore, this can be useful if you need a fix or a new function that is still not available in the QGIS repository. Moreover, the master version in the SCP repository can be installed along with the version available in the QGIS repository.

In order to install the SCP repository follow these steps:

  • Run QGIS 2;
  • From the main menu, select Plugins > Manage and Install Plugins;
_images/install_u.jpg
  • Click Settings then click the button Add;
_images/qgis_repos_settings.jpg
  • Inside the Repository details enter:

Name:

SCP

URL:

https://semiautomaticgit.github.io/SemiAutomaticClassificationPlugin/repository.xml

and click OK;

_images/qgis_repos_add.jpg
  • After the repository update, the item Semi-Automatic Classification Plugin - master should be listed with the other plugins;
_images/qgis_repos_list.jpg
  • From the menu All, select the Semi-Automatic Classification Plugin - master and click the button Install plugin; the latest version of SCP should be automatically activated (ignore errors, the restart of QGIS could be necessary to complete the SCP installation); it is possible to deactivate the other SCP installed in the QGIS repository;
_images/qgis_repos_installed.jpg

7.2. Pre processing

7.2.1. Which image bands should I use for a semi-automatic classification?

In general, it is preferable to avoid thermal infrared bands. If you are using Landsat 4, 5 or 7 you should select bands: 1, 2, 3, 4, 5, 7 avoiding band 6 that is thermal infrared; for Landsat 8 you should select bands: 2, 3, 4, 5, 6, 7. Landsat 8 band 1 is generally avoided because it is very similar to the blue band and it is mainly used for coastal aerosol study. Landsat thermal infrared band is excluded from classifications because values are mainly related to object temperature.

For Sentinel-2 images you can use bands: 2, 3, 4, 5, 6, 7, 8, 8A, 11, 12.

7.2.2. Which Landsat bands can be converted to reflectance by the SCP?

All Landsat 1,2, and 3 MSS and Landsat 4, 5, 7, and 8 images downloaded from http://earthexplorer.usgs.gov/ and processed with the Level 1 Product Generation System (LPGS) can be converted to reflectance automatically by the SCP; products generated by the LPGS have a MTL file included that is required for the conversion. Since version 3.1.1 the SCP can also convert images from the Global Land Cover Facility (images available for free from ftp://ftp.glcf.umd.edu/glcf/Landsat/). In particular, images having an old format of the MTL file (or a .met file) can be processed through the automatic conversion to reflectance and the DOS correction. However, some images do not have the required information and cannot be processed. Also, notice that some images available from the Global Land Cover Facility are already converted to reflectance. For this process, image bands must be renamed in order to remove the final 0 if present (e.g. rename B10 to B1).

7.2.3. Can I apply the conversion to Sentinel-2 images download from the web?

Yes, you can convert also images downloaded from the web (actually the conversion is recommended). You should move all the bands (.jp2 files) and if available the .xml file whose name contains MDT_SAFL1C in the same directory. Then select this directory in Sentinel-2 conversion. Images are converted to reflectance.

7.2.4. How are converted Sentinel-2 images that have different resolutions?

During the conversion to reflectance, pixels of 20m bands are split in 4 pixels of 10m whose values are the same as the original 20m pixel. The purpose of this operation is to allow for the calculation between all the bands, without changing original values.

7.2.5. Can I apply the Landsat conversion and DOS correction to clipped bands?

Yes, you can clip the images before the conversion to reflectance and then copy the MTL file (contained in the Landsat dataset) inside the directory with the clipped bands. If you want to apply the DOS correction (which is an image based technique) you should convert the original Landsat bands (the entire image) and then clip the conversion output (i.e. bands converted to reflectance).

7.2.6. Can I apply the DOS correction to bands with black border (i.e. with NoData value)?

If you want to apply the DOS correction to an entire band which has NoData values (the black border with value = 0) then you have to check the checkbox Use NoData value and set the value to 0. This is because DOS is an image based technique, and NoData values must be excluded from the calculation.

7.2.7. How to remove cloud cover from images?

DOS1 correction does not remove clouds from the image. However, Landsat 8 images include Band 9 that identifies clouds (see this NASA site). You can use this band for the creation of a mask.

For other Landsat satellites, clouds can be masked using the approach described this paper.

Also, see the following video-tutorial.

7.2.8. How do I create a virtual raster manually in QGIS?

In order to create a multi-spectral virtual raster in QGIS:

  1. from the menu Raster select Miscellaneous > Build Virtual Raster (catalog);
  2. click the button Select... and select all the Landsat bands (in numerical order);
  3. select the output file (for instance rgb.vrt); check Separate (bands will be separated) and click OK.

7.2.9. After pan-sharpening of Landsat 8 images, why NIR bands still have 30m resolution?

Landsat 8 panchromatic band doesn’t acquire in the Near Infrared (NIR) region (see Landsat Satellite). Therefore, the pan-sharpening process can’t improve the resolution of NIR and SWIR bands (see Pan-sharpening), which appear to have 30m resolution. However, raster all pan-sharpened rasters have 15m resolution to allow raster calculation.

7.3. Processing

7.3.1. I get classification errors. How can I improve the accuracy?

Several materials have similar spectral signatures (e.g. soil and built-up, or forest and other types of dense low vegetation), which can cause classification errors if ROIs, and spectral signatures thereof, are not acquired correctly. In order to improve the results, you can try to collect more ROIs over these areas, in order to train the algorithm for these very similar areas, also, display the spectral signatures of these areas in Spectral Signature Plot to assess their similarity. You can also use a Signature threshold for these signatures in order to reduce the variability thereof (only pixels very similar to the input signatures will be classified). The Land Cover Signature Classification is also useful for classifying specific materials that can be spectrally similar to other ones.

7.3.2. Is it possible to use the same training input for multiple images?

Yes, it is possible if all the images have the same number of bands. However, if images are acquired in different months, land cover changes (especially of vegetation state) will affect the spectral signature (i.e. the same pixel has different spectral signature in different periods). Atmospheric effects could also affect the images differently. That could reduce classification accuracy. Therefore, it is suggested to collect always the ROIs and spectral signatures for every image.

7.3.4. Can I use SCP with images from drones or aerial photographs?

Yes, you can use them if they have at least 4 bands. With less than 4 bands, semi-automatic classification algorithms are unable to classify the land cover correctly. Alternative classification methods exist, such as object oriented classification, which is not implemented in SCP.

7.3.5. Why using only Landsat 8 band 10 in the estimation of surface temperature?

Several methods were developed for estimating surface temperature. The method described in the tutorial for temperature estimation requires only one band. Moreover, USGS recommends that users refrain from relying on Landsat 8 Band 11 data in quantitative analysis of the Thermal Infrared Sensor data (see Changes to Thermal Infrared Sensor (TIRS) data by USGS).

7.4. Warnings

7.4.1. Warning [12]: The following signature will be excluded if using Maximum Likelihood. Why?

The ROI is too small (or too homogeneous) for the Maximum Likelihood algorithm because that ROI has a singular covariance matrix. You should create larger ROIs or don’t use the Maximum Likelihood algorithm in the classification process.

7.5. Errors

7.5.1. How can I report an error?

If you found an error of the Semi-Automatic Classification Plugin please follow these steps in order to collect the required information (log file):

  1. close QGIS if already open;
  2. open QGIS, open the Plugin tab Debug and check the checkbox checkbox Records events in a log file ;
_images/settings_debug_tab.jpg

Debug

  1. click the button Test dependencies enter in the tab Debug ;

  2. load the data in QGIS (or open a previously saved QGIS project) and repeat all the steps that cause the error in the Plugin;
  3. if an error message appears (like the one in the following image), copy the whole content of the message in a text file;

_images/python_error.jpg

Error message

  1. open the tab Debug and uncheck the checkbox checkbox Records events in a log file, then click the button export and save the log file (which is a text file containing information about the Plugin processes);
  2. open the log file and copy the whole content of the file;
  3. join the Facebook group or the Google+ community , create a new post and copy the error message and the log file (or attach them).

7.5.2. Virtual raster creation issues. Why?

The automatic creation of the virtual raster after Landsat conversion to reflectance is not required for the classification. Errors could happen if the output destination path contains special characters (such as accented letters) or spaces; try to rename directories (e.g. rename new directory to new_directory). If you still get the same error you can create a virtual raster manually.

7.5.3. Error [26] ‘The version of Numpy is outdated’. Why?

QGIS 32bit could have an older version of Numpy as default; in order to update Numpy:

  1. download this file (which is based on WinPython installer and PyParsing);
  2. extract the file with 7-zip;
  3. copy the content of the extracted directory inside the directory apps\Python27\Lib\site-packages inside the QGIS installation directory (e.g. C:\Program Files (x86)\QGIS Chugiak\apps\Python27\Lib\site-packages) overwriting the files pyparsing, numpy, matplotlib, and scipy.

Alternatively, you should be able to install QGIS and Numpy with the OSGEO4W advanced installer.

7.5.4. Error ‘Plugin is damaged. Python said: ascii’. Why?

It could be related to a wrong installation. Please, uninstall QGIS and install it again with administrative rights. Delete also the directory .qgis2 in your user directory. Then run QGIS 2 and try to install the plugin following the Plugin Installation guide.

Also, it could be related to the user name containing special characters. Please try the installation creating a new user without special characters (e.g. user).

Also, if the error message contains something like:
sfnt4 = sfnt4.decode('ascii').lower()

it could be related to a known issue of Matplotlib (a Python library); in order to solve this, you should (as reported at stackoverflow):

  1. open in a text editor the file font_manager.py which is inside the directory C:\PROGRA~1\QGISCH~1\apps\Python27\lib\site-packages\matplotlib\

  2. search for the line

    sfnt4 = sfnt4.decode('ascii').lower()

  3. and replace it with the line

    sfnt4 = sfnt4.decode('ascii', 'ignore').lower()

Alternatively, try to install QGIS through the OSGEO4W installer, which includes an updated Matplotlib version.

7.5.5. Error [50] ‘Internet error’. Unable to download Sentinel-2 images. Why?

The error message usually includes some information about the issue. First, check the user name and password.

Also, there could be an interruption of the service. For Sentinel-2 images please check this website https://scihub.copernicus.eu/news/ for messages about the state of the service.

In case you still get the same error, please follow these steps How can I report an error?.

7.5.6. Error [56] ‘SSL connection error’. Unable to download Sentinel-2 images. Why?

First, check the user name and password.

This issue could be related to SSL protocols (TLS v1.1 and TLS v1.2) required for Sentinel-2 download. As described here https://docs.python.org/2/library/ssl.html the protocols TLS v1.1 and TLS v1.2 are available only in Python 2.7.9+ with openssl version 1.0.1+. QGIS could have a previous version of Python where TLS v1.1 and TLS v1.2 are not available. Therefore the Sentinel-2 download process fails.

A temporary solution for Windows OS:

Warning: this could break other QGIS functions, but fortunately you can install multiple versions of QGIS.
  1. Close QGIS if open
  2. Download and install Python for 32bit or for 64bit according to the installed version of QGIS
  3. Copy and replace C:\python27\python.exe to "QGIS installation folder"\bin\ (e.g. C:\Program Files (x86)\QGIS Chugiak\bin\)
  4. Copy and replace C:\python27\pythonw.exe to "QGIS installation folder"\bin\
  5. Copy and replace all the content of C:\python27\ to "QGIS installation folder"\apps\python27\
  6. Now start QGIS and if everything went well you should be able to search and download Sentinel-2 images using SCP

In case you still get the same error, please follow these steps How can I report an error?.

7.5.7. This plugin is broken ‘matplotlib requires pyparsing >= 1.5.6’. Why?

It is related to this issue https://hub.qgis.org/issues/14952 which should affect QGIS 32bit only. The installation of QGIS 64bit should work. As a solution you can install a previous version of QGIS 2.8 32bit .

7.5.8. Error installing the plugin, possible missing dependencies. Why?

The plugin requires the installation of GDAL, NumPy, SciPy and Matplotlib, which should be installed along with QGIS. If the plugin installation fails, and you get a message about possible missing dependencies, you should try to install or update QGIS and the required dependencies. Notice that in order to avoid this error, python dependencies should not be installed through Anaconda.

7.6. Various

7.6.1. What can I do with the SCP?

SCP allows for the land cover classification of remote sensing images through Supervised Classification. You can produce a land cover raster using one of the Classification Algorithms available in SCP. These algorithms require spectral signatures or ROIs as input (for definitions please read Brief Introduction to Remote Sensing) that define the land cover classes to be identified in the image.

_images/multispectral_classification.jpg

A multispectral image processed to produce a land cover classification

(Landsat image provided by USGS)

SCP can work with multispectral images acquired by satellites, airplanes, or drones. Also, SCP allows for the direct search and download of free images (see Download images). You cannot use orthophotos with less than 4 bands, SAR data, and LIDAR data with SCP.

Input image in SCP is called Band set, which is used as input for the classification. SCP provides several tools for the Preprocessing of downloaded images, such as the conversion to reflectance and manipulation of bands.

Classification results can be assessed with the tools Accuracy and Classification report. Also, rasters can be manipulated using Postprocessing tools such as Classification to vector, Reclassification, Edit raster directly, Classification sieve, Classification erosion, and Classification dilation.

The Spectral Signature Plot and Scatter Plot allow for the analysis of spectral signatures and ROIs. Also, several Tools are available for easing the ROI creation and editing spectral signatures.

Raster calculation is available through the seamless integration of the tool Band calc with bands in the Band set, calculating mathematical expressions and spectral indices. Also, an output raster can be calculated based on Decision rules.

The tool Batch allows for the automatic execution of several SCP functions using a scripting interface.

See the Basic Tutorials for more information and examples.

7.6.2. How to contribute to SCP

You can contribute to SCP by fixing and adding functionalities (see Where is the source code of SCP?), or translating the user manual (see How can I translate this user manual to another language?).

Also, you can donate to this project at the following link https://fromgistors.blogspot.com/p/donations.html .

7.6.4. Other tutorials about SCP, also in languages other than English?

There are several tutorials about SCP on the internet. Following an incomplete list of these resources:

7.6.5. How can I translate this user manual to another language?

It is possible to easily translate the user manual to any language, because it is written in reStructuredText as markup language (using Sphinx). Therefore, your contribution is fundamental for the translation of the manual to your language. The following guide illustrates the main steps for the translation, which can be performed:

  • using the free online service Transifex;
  • using the gettext .po files.

Before translating, please read this document from the QGIS translation guide, which helps you understand the reStructuredText.

Method 1. Translation using the free online service Transifex

This is probably the easiest way to translate the manual using an online service.

  1. Join the Semi-automatic Classification Manual project

    Go to the page https://www.transifex.com/semi-automatic-classification/semi-automatic-classification-plugin-manual and click the button Help translate. You can sign in using your Google or Facebook account, or with a free registration.

  2. Select your language

    Select your language and click the button Join team. If your language is not listed, click the button Request language.

  3. Translation

    There are several files to be translated, which refer to the sections of the SCP documentation. To translate the SCP interface you should select the file semiautomaticclassificationplugin.ts .

Method 2. Translation using the gettext .po files

In order to use this method, you should be familiar with GitHub. This translation method allows for the translation of the PO files locally.

  1. Download the translation files

    Go to the GitHub project https://github.com/semiautomaticgit/SemiAutomaticClassificationManual_v4/tree/master/locale and download the .po files of your language (you can add your language, if it is not listed), or you can fork the repository. Every file .po is a text file that refers to a section of the User Manual.

  2. Edit the translation files

    Now you can edit the .po files. It is convenient to edit those file using one of the following programs: for instance Poedit for Windows and Mac OS X, or Gtranslator for Linux or OmegaT (Java based) for Windows, Linux and Mac OS X. These editors allow for an easy translation of every sentence in the User Manual.