Rndom forest classification steps

glad to see this worked.
Did the reprojection change your values in any way? If I undestand you correctly you selected WGS84 in the terrain correction and then reprojected also to WGS84?

I reproject the data into Geographic Lat/Lon. After that, the values do not change.
I try some times with some different data and I find out that in the classification step, it works with the Lat/Lon project.


good to know, although it is ab bit strange that this step is required.

hi , i need help
you have created polygon on sigma0_hh_db,s o how you had applied on _glcm product ,as both are different
or i have to stack sigma0_vv_db band to _glcm product.
where to give polygon on sigma0_vv_db or any one of the glcm product

create the GLCM layer and stack it with your oiriginal Sigma0 file. The final product will contain both the intensity and the textures.

1 Like

after following your step ,i got this classification

can help in identifying the black area
as that is a river area, but i made two classes blue showing water area , then why black?
and what does confidence image tells.

areas which are not classified do not fulfill the confidence criterion of Random Forest, that means they cannot be assigned to one of the classes.
You should read a bit about the classifier before applying it:

Please also use the search function for common questions:

1 Like

Did you uesd the raster layer to train the samples ?there I had uesd the raster to classfy the study areas with 3 types .if you do please tell me .

you see in the screenshot that she used training vectors (red squares).

You can only use rasters as training inputs if they represent the final classes (e.g. land cover maps).

Please have a look here: Supervised and unsupervised classification, Sentinel 2

hi,sir it didn’t work when I classfy with RF, as follows ,

what should i do?

Classification of S2 products only works with reprojected data, please have a look here:

thank you sir ,i had get it.

dear ABraun sir,I had a train classification results,as follows,but it failed when i try to run the RFclassfication(my study area is moutain glacier ,need to classfied with wet snow,dry snow ,moranie,and ice) [图片]

please specify the problem.

Dear @ABraun,
I am running Random Forest to classify a stack image (between SAR band and several texture band created from DEM). Bearing in mind that Random Forest can work with data quite flexibly. However, I faced this error and did not know why. Do you have a clue for that?
Thank you!

Another issue is my stacking image could not be opened (after subsetting and applying Land/sea mask). And I don’t know why. Can you please help me to solve it?


the NullPointerException is not telling us much about the source of the error, but we can try to narrow it down.

  • have you saved the product after importing the vector geometries
  • could the vectors contain invalid geometries?
  • are all used bands converted to a physical product?
  • are ther nodata values inside the texture layers? Please remove all “valid pixel expressions” and “no data” definitions in the properties of all bands and save the product.
  • have you tried running it with only the Sigma0 bands to check if the problem persists? This would indicate that the other bands cause problems

Dear @ABraun
messages.log (149.5 KB)
I try to reproject, and it could not be done with the below message.

  • I did save the product
  • I remove the vector file, and reproject, then the below message appear
  • All texture bands were in digital number (both negative and positive number) when converted to *.geotiff for stacking in SNAP
  • How do we check the “valid pixel expressions” and “no data” to remove them?
  • The sigma naught bands were OK.
  • The upload text file is the log file when I check for detail why the software does not work.


I check the data layer properties and remove all the check mark in row No Data value Used, then save it and run the classification again. It still does not work with the red words at the bottom of the dialog “Incomplete expression” :frowning:

please completely remove all the geometries from the product, save it and import them again.

If the RF works with the Sigma0 bands, there is something wrong with the texture layers. Please check the valid pixel expressions again if you have left a character or something (Missing ‘)’ sounds like there is an incomplete statement)