Supervised and unsupervised classification, Sentinel 2

Yes. It asked me that which container is to be digitized for every time you click in the map but still the polygon is empty.
You can see it here that it asks me and I choose correct one.

pull the geometry column a bit wider with your mouse. It is stored as a WKT like

POLYGON((8.179687410593033 49.11654977356537,10.201171785593033 49.11654977356537,10.201171785593033 47.47959357730535,8.179687410593033 47.47959357730535,8.179687410593033 49.11654977356537))

Maybe you just didn’t see it in the current display mode.

15 posts were merged into an existing topic: Blank result after supervised classification. Why?

Try to decrease number of your training samples. I am not sure what is it but when I decreased on value of 20 classification run out without problems and there was no blank screen!!

I am not sure what is training samples - are they values of pixels inside your training classes (vectors)?

Hi, thanks for the response. I’ve solved this problem now. It has to do with reprojecting the image before classification. Once the reprojection (to WGS84) is done the classification works fine.

And yes - training pixels are the pixel values inside the vector polygons.

1 Like

I am having another issue with supervised classification, the feature bands selection are not visible (please refer to image), therfor I just can select which band I need. I created thenew vector containers and used to polygon tool to select the zones.

Could you kindly help.

You need to resample the bands to a common size. The processor can’t handle the data when the dimension of the source bands is different.
You can either use the generic Resampling operator in Raster / Geometric Operation which is faster or the S2 specific one in Optical / Geometric which is slower but handles the view angles more accurate.

1 Like

@andy , @ABraun I have exact problem after running RF classification I got a blank raster image and question mark in frequency. I saw our member mention about projection.

(maybe the solution) Then I try to reprojection but I left everything is default particularly the projection is Geographic Lat/Lon (WG84) [Dont choose UTM / WGS84 (Automatic)]. Then the classifier work well. (I dont know what happend next if we export into QGIS)

1 Like

It’s kind of a bug. The data must be projected into geographic coordinates first.

Doesn’t matter for the later use of QGIS. You can still open it there and overlay it with other data in UTM projection. Maybe you need to reproject the result back into UTM if you want to intersect this data with other rasters/vectors in QGIS.


Thanks brother ABraun! I already tried I have to reprojection the result back into UTM otherwise it is not overlay with other shapefile which has UTM/WGS84.
I have one more question. As show in image below (red rectangle), the surrounding lake was incorrectly classified as Mangrove. How to improve this situation? I found on QGIS, we can directly edit raster. But does anybody have other options?

Thank very much!!!

change the Mangrove training data.


Dear All,

I would like to export the KNN classification results (shown in red below ) in a text file, however I can’t do it with the export masks tool. Is there any other way pls?

Did you check up the meta data of the classification results?

You could also export the results as ‘csv’, from File —> Export —> csv

Check up this video could helps,

import and export files in SNAP, Source :

I hope this is the right topic to discuss it…
Is there a reason that supervised classification in snap does not have a ROI-mask as unsupervised has? Am I missing something or is there another side-way to accomplish ROI?

as a work-around: you could import the vector and declare it in the valid pixel expression of the input bands.
Afterwards, your classification will only be performed on the valid pixels left.

That’s a good solution. I will work it and I will see if I can implement it in batch processing with graph builder but I have my doubts. Working those few weeks with graph builder I find it hard to accomplish more complex operations in classification with sentinel-2 products.

i have de same mistake, after the instalation of the version SNAP 7.0 about supervised qualificationRF . Now my doubt is if, that projection has to be made after or before training pixel ?

Note: of course, the steps taken before the training pixels are resampling and subset in the imagen

first you reproject, then you digitize the training data.

1 Like

solucionado .

Am considering Random Forest Model for my classification, any other better model to try out?