Geographic Information Systems Asked on July 10, 2021
I have a code for performing an index calculation on chosen images and in chosen AOI. The next step I want to do is segment it by pixel value and classify them into 3 groups. I mean a range of pixel values for each group. After that from the borders/area of the 3 groups, I want to make a feature object so I can calculate indices on them.
I don’t know how to do it or the options that I have for doing it.
'''// Images for the ImageCollection:
var image1 = ee.Image('COPERNICUS/S2_SR/20181003T081751_20181003T082718_T36SXA');
var image2 = ee.Image('COPERNICUS/S2_SR/20191013T081859_20191013T083011_T36SXA');
var image3 = ee.Image('COPERNICUS/S2_SR/20201007T081759_20201007T082035_T36SXA');
// Create a collection with fromImages().
var CollectionFromImages = ee.ImageCollection.fromImages(
[ee.Image(image1), ee.Image(image2), ee.Image(image3)]);
print('CollectionFromImages: ', CollectionFromImages);
// Load raster data (COPERNICUS/S2_SR).
// Load vector data (shapefile).
var fc = ee.FeatureCollection(user_account+folder+shpfile_name);
var filter = ee.Filter.inList('Name', ['Shoresh 7']);
var filteredArea = fc.filter(filter);
var S2 = ee.ImageCollection(CollectionFromImages);
print(fc) // CRS must be WGS84 (for the shapefile)
//Image Expression for calculating BSI----------------------------------------------
var band_1 = 'B2'
var band_2 = 'B4'
var band_3 = 'B8'
var band_4 = 'B11'
var addBSI = function(image) {
var BSI = image.expression(
'((B11+B4)-(B8+B2))/((B11+B4)+(B8+B2))',
{
'B2': image.select('B2'),
'B4': image.select('B4'),
'B8': image.select('B8'),
'B11': image.select('B11'),
}).rename('BSI');
//NDVI index
return image.addBands(BSI.add(ee.Image(0.0)));
//Add 0.0 value to BSI (currently not in use)
};
// Calculate BSI for images in the Image collection
var S2_withBSI = ee.ImageCollection(S2).map(addBSI);
print(S2_withBSI)
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP