Supervised and unsupervised classification, Sentinel 2

I do have the same issue

you can also ressamping the [S2A_USER…] to save as the ENVI format(choose you need resolution), and then processing in the ENVI software.

Dear zgramos,

I have your same problem about “no data” and I did the reprojection but I didn’t get through the problem. Do you have some news about this “bug”?


Dear Pierro,
My issues were solved with the reprojection of the data before the classification.

1 Like

I updated everything to the latest version and it STILL doesn’t work. Now, there’s no mysterious red error, it informs you that classification has been completed at couple MB/s, but the resulting classified image doesn’t load properly. In fact, there’s no data in it (img file contains only 0xFF).
I have to say I am very frustrated. Did you ever test this thing?! :angry: I can show you step by step what I do for you to repeat, but if you promise to actually repeat it and look what causes it.

I did supervised classification also. To explain what I did, I write down step by step because something went wrong and the result were not what I expected:

  1. resampling image
  2. subseting image
  3. defining geometries
  4. saving
  5. reprojecting
  6. supervised classification ( KNN-classifier, took 4 hours)
    and result

Almost the same (even worse) happened when I tried unsupervised classification ( K-means ):

Any ideas what I did wrong?

what was your input data and why do you think the results are wrong?

How does one carry out a validation using the training dataset? I dont see where to separate the training and testing data

if you validate using the training data you just validate how good the classifier was able to fit your training data.
To validate the classification independent validation areas have to be collected as well.


My input file name is: S2A_OPER_MTD_SAFL1C_PDMC_20160519T175247_R036_V20150804T094005_20150804T094005.xml
While resampling I used these parameters:

After resampling I subsetted a specific area using these parameters:

For the next step i defined geometries on the subsetted image and saved the project (file):

After saving I did these steps : Raster -> Geometric operations -> reprojection. When the reprojection was done i noticed that the image was streched from left to right.

The finished product was ( as shown in the previous comment):

I know that the result is wrong because half of the image is covered with water, but it should be mainland including forest, roads etc.

I hope that now you understand my problem and have a solution for it. Thank you in advance!

Thanks Andreas for your speedy response. Question is, how does one do the
validation? How is it setup in SNAP?


I don’t think it’s possible in SNAP, but I can recommend the SCP plugin for QGIS

1 Like

That’s the semi-automatic classification plugin?

yes, it provides great post-processing options for classification. img-files of the dimap format can directly loaded into QGIS.

Ok, great. I will try QGIS. Cheers and thanks

Hi again. I am re-running the classification in SNAP and I get the following message: The device is not ready.

What could be the issue?


Often it is caused by a wrong path to a file.

1 Like

Thanks…had figured it out!

I am unable to load dimap files into QGIS…what could I be doing wrong?

Don’t open the dim-file, this is only the metadata. Take the img-file from the folder of same name.

1 Like