Agriculture and Sentinel-2: An unsupervised temporal classification

Remote Sensing and agriculture always have been best friends. With the arrival of Sentinel-2 data, the friendship got even more stronger! In this article, we’re trying to figure out how we could use Sentinel-2 data to make an unsupervised crop parcel classification. With a reference image by side, we then determine the crop types. The study area is in the UTM Zone 31UFS (Belgium).

Our goal in this article is to identify different agricultural crop parcels using temporal satellite imageries by applying an unsupervised classification. Agricultural parcels look different depending on the season we’re looking at. Land is usually naked during winter and crops commence their growth in early Spring. The growth peak is around May, June or July for most of the cultures but some others are highest in August or September. Doing a classification on a unique scene will not be suitable as all bare lands will look the same (even if they later differentiate depending on the crop type).

The images on which we do the classification were taken at two different periods. Sentinel-2 scenes are composed of 13 different bands of different resolutions. The crop types, and all the land in general, thus have a different spectral signature. The more bands they are, the easier the differentiation between two crop types will be. Merging both scenes into one and unique document having a total of 20 bands, leaving by side the 60-m resolution bands 1-9-10, will make the differenciation even more relevant. Notice also that two bare land parcels looking the same at the same period are thus not considered as being of the same crop type when they have different spectral signature at another moment.

We decided to make a temporal unsupervised classification using satellite images on two different moments: One was taken the 21th of April 2016, the other the 26th of August 2016.

Here are the steps we followed. Note that I use ArcGIS for Desktop with the Spatial Analyst extension.

  • Data acquisition (21/04/2016 and 26/08/2016)
  • Band composition
  • Unsupervised classification
  • Crop identification using a reference document (official SPW document)

Data acquisition

The Sentinel-2 data can be acquired using the Sentinels Scientific Data Hub or using the open Sentinel-2 on AWS service (preferred method). From the AWS service webpage, use the interactive data search application. Zoom to the area of interest, specify the data and the cloud coverage, and go on the tile data link page.

Sentinel-2 data service on AWS

Sentinel-2 data service on AWS

Sentinel 2 data structure

Sentinel 2 data structure

The dates are not chosen randomly: we need to have a minimum cloud cover percentage. The document of the 21st of April is the best one during the considered growing season. Fortunately, the last scene available (26th of August) is cloud free.

Two scenes
Two scenes – True color (band combination 432)

Band composition

As said, we want, first, to create a unique scene composed of 20 bands. Using ArcGIS for Desktop, we use the Composite Bands tool. As input, we specify all the layers B02.jp2, B03.jp2, etc. but not B01.jp2, B09.jp2 and B11.jp2. These bands corresponds respectively to the aerosol band, water vapour and cirrus bands. We exclude them because their resolution is about 60m, which is the highest of all the bands considered.

Unsupervised classification

The unsupervised classification is done straighforward. Activate the Spatial Analyst extension and add the Spatial Analyst toolbar to the menu.

Spatial Analyst toolbar
Spatial Analyst toolbar

Click on the Iso Cluster Unsupervised Classification feature and specify 35 as the number of output classes (remember, the scenes represent an area of 100x100km).



Here’s the raw result in greayscale.

Raw unsupervised classification

Raw unsupervised classification

We need now to clean up this result. This image contains a lot of speckles that we need to clean up. Also, there are lots of areas which are so small around other areas that we need to delete.

We run the Majority Filter that assign to isolated pixels the pixel of their more frequent neighbors.



And then a Boundary Clean operation.



The Region Group processing groups together pixels that have the same values. After this operation, we have the 35 classes cleaned up. Attention however as small areas such as isolated pixels, isolated and small pixel corridors, etc. can remain in the image. We now clean this up as we first need to define a threshold from which we consider removing the area



We use the Set Null operation where we consider that areas of less than 40 pixels are removed.


Set Null operation

The last operation is Nibble. As input, we take into account the mask that we just define with the Set Null operation and the cleaned unsupervised image (coming out from the Boundary Clean operation).



Crop identification

We finally got our clean classification result! The last thing to do is to add a reference layer in order to identify the crops. The same areas on both the reference layer and our classification are supposed to be of the same type. Notice however that we discovered some differences and we see two main reasons:

  • Our classification is based on 2016 imageries whereas the reference document is from 2015. It is possible that crop type change from one year to another
  • Our technique to identify the same crop types is not optimal (similar spectral signatures from different crop type, too broad temporal resolution and not enough images taken into account (April – August), etc.)

As we are in Belgium and mostly in the Walloon Region, we can take a ready to use layer provided by the SPW (Service Public de Wallonie).



Here is our final result.

Agriculture classification

Agriculture classification


We’ve seen that with the two provided Sentinel-2 data using both 10 bands and ArcGIS for Desktop, we were able to run an unsupervised classification and to assign the detected zone to crop type using a reference image.



20 thoughts on “Agriculture and Sentinel-2: An unsupervised temporal classification

  1. Bravo! Hi, am a GIS analyst for my company and i love Remote Sensing. My final year project was spatio-temporal LULC usin Landsat Imagery. I learnt alot of thing just now from this project. Thanks

  2. What resolution was the final product? Bands 2,3 ,4, and 8 and the others you used are 20m resolution. I assume that resampling was done to move to a common 20m resolution, but what method was used for the resampling?

  3. Sorry, correction.
    What resolution was the final product? Bands 2,3 ,4, and 8 are at 10m resolution and the others you used are 20m resolution. I assume that resampling was done to move to a common 20m resolution, but what method was used for the resampling?

    1. Hi Doug!

      Thanks for your comment! There was no resampling to a common 20-m. It is just that 4 pixels in the 2, 3, 4 bands corresponds to a unique pixel value in the 8 band. This is quite confusing as I say in my article not taking into account the 60-m resolution bands.

      Hope this help,


  4. Thanks. Nice work. Am new on GIS and Remote sensing so i dont understand how the band combination works. What can i do learn or perfect myself remote sensing and band combination? Also this is my first time of hearing about Sentinel-2 data, can u elaborate on d data? Pls

    1. Hi Olufemi! Thanks a lot for your comment!
      This article from the Natural Resources Canada is very very good
      Also, here’s a video course about remote sensing and focused on the European Commission’s Sentinel Programme:
      Do not hesitate to ask!
      Best Regards,

  5. Hi Daniel
    i do wish to carry out a similar step as shown in one of the states within Nigeria, West Africa. Are the sentinel data products also cover areas outside the European continent. Cheers

  6. Hi Dan

    Nice article…proposes a simple and quick way to map different crop types. I have one quick question on the selection of dates for the analysis.

    Why did you opt to use April and August images? How much of that was influenced by the different cycles of the cultivated crop’s?
    Was April before or the planting period thus bare land exposed?

    I look forward to your response.

    Thanks in advance
    Kind Regards

    1. Hi Takura,

      Thank you very much for your comment!

      The dates are arbitrary, I could have chosen different ones. The goals was to have two scenes with completely different crop evolution stages.

      As it is not stated in the article, I am only doing prototypes for my blog. The result should not and must not be used for scientific results. To have better classification, I guess we should add more scenes than just two.

      Also, the scenes to be chosen are very dependent on meteorologic conditions: Clear skies are necessary!

      I hope these answers help,
      Best Regards,


  7. Mr Demonceau
    I have some questions if you could please answer them.
    The Region Group procedure happens after or before the “Set Null operation”?
    What is the “Set Null operation”? Is it the Set Null tool procedure? Where does one set the 45pixel threshold? The output of it is useful for the next step as i see (stuck at this step), but where is the Region Group result used?
    I am sorry for the multiple questions, but i am new and do not fully understand the procedure.
    Finally i constructed the Boundary Clean raster, but it is strange (I have never used that tool before) : It is a 1 band raster that the lower in the image the higher the pixel values, like a fixed rainbow. Why is that? Is it correct?

    Thank you very much
    Kind regards,

    1. Hi OV!

      Thank you for your comment!

      The Region operation is executed before the SetNull operation. The purpose is to eliminate the areas which are smaller than 45 contiguous pixels. The input data are not perfect and the algorithm will let behind “lost pixels”, these need to be not considered.

      The result of the Region Group is used as input of the SetNull processing.

      For your last question, I am not quite sure I understand. What is the lowest/highest value about?

      Thank you OV, I am here to help where I can=
      Best Regards,


  8. Hi Daniel.
    May l know where you get 06.classification_setnull_data? so as your project, in region group created 05.classification_clean_delta. Probably use another method before last operation. is this set null which place in conditional box?


    1. Hi Bakhtiyar!

      Thank you so much for your comment!

      The right order of operations is 05.Region, 06.SetNull, 07.Nibble. And the input for an operation is the output of the previous operation.

      Hope this helps?


  9. 06 SetNull is which image did u took? I could not find/or understand the data..
    I am trying to take 35 classes but in return its giving me 10 reason behind it?

Leave a Reply

Your email address will not be published.

Proove you're not a robot * Time limit is exhausted. Please reload CAPTCHA.