ERROR in kmeans cluster analysis when running a batch


I executed a kmeans cluster analysis using a batch (in GUI) and didn’t work.
I erased the error message before I saved it (ups!!) but this is the result once I open the file it has created (a yellow image).

In fact, in the graph builder I couldn’t select the bands I wanted to use for the cluster analysis. The image I want to use for the cluster analysis is a mosaic of a couple of original Sentinel 2 images.

Do you think the fact I cannot select the bands might be the problem??How can I fix it??

Any help will be much appreciated!

Is the result the same if you run it outside the batch mode?
What is your input data?

Yes, the result is the same as if I run it in the graph builder.
However I’m executing the tool directly from the menu (Raster-Classification-unsupervised-kmeans) and it seems it’s working properly and I was able to select the bands for the cluster analysis.

The input data is a mosaic of two sentinel 2 images.

it’s strange indeed that there is no choice for data. I was able to reproduce this behaviour at my PC.
You can try if it helps when you add a “select band” operator in between read and classification.

The Graph Builder was initially implemented for SAR processing and some use cases for the optical processing were not considered. That’s why some operators are not shown or don’t work properly. This should get better with upcoming releases.

@MLOPEZ using the kmean directly from the menu is the better way to apply it to your data. If you want to do it on multiple products you can do it from the command line with gpt.

It would be nice if I can use command line with gpt but haven’t used it yet. I have been looking at the forum but didn’t find anything I could use. I know I can use the xml generated in the graph builder but didn’t know how to connect with the gpt through the command line. Is there any tutorial I could use?? How I call snap from command line??

Any help will be much appreciated!!

There is some information in the help of SNAP. But this is very brief.
This wiki page will be more helpful, I guess.


The process hasn’t finished yet (after more than 24hours)… Is there any problem executing a kmeans cluster analysis using a mosaic as an input data?? It doesn’t seem to work…

How big is the mosaic and how big is your machine?

It is probably better to do the clustering on each scene separately or you might need a big machine with a lot of RAM.