1 - Create a function to: - calculate the area in hectares for each of the two bands of…
- User
1 - Create a function to:
- calculate the area in hectares for each of the two bands of "imagebands1" ('vereda','arenizacao') and "imagebands2" ('vereda','freq_arenizacao');
- calculate the percentage of each of the two bands of each image as well;
- insert the result (area and percentage) in the properties of each feature of the featurecollection "table4" (apply ".map()" on table4); The result should be the area of the veredas and the sandblasting as a property in each feature of the featurecollection table4. 2 - Create another function to:
- generate an image with a constant value for each feature (put the value of the area calculated and inserted as a property previously);
- use "mosaic" to generate the final image;
- generate the visualization of the final image; The result should be an image that shows the percentage in its colors Here is the script example: Map.setOptions("SATELLITE"); // "ROADMAP", "SATELLITE", "HYBRID" or "TERRAIN"
var geometry = ee.Geometry.Polygon( [[[-48.90990751290743, -8.920219511710798], [-48.90990751290743, -16.649225798686256], [-42.66967313790743, -16.649225798686256], [-42.66967313790743, -8.920219511710798]]], null, false);
var table4 = ee.FeatureCollection("projects/ee-maximoicmbio/assets/ottobacias_n5_urucuia_veredas_doc");
Map.addLayer(table4, {}, 'teste')
var veredasmapbiomasfreq = ee.FeatureCollection("users/maximomenezesgee/Otto_4_Urucuia_mapbiomas_veredas_Union2"); var arenizacao = ee.FeatureCollection("users/maximomenezesgee/Otto_4_Urucuia_Landsat_Union_arenizacao3");
var mascara1 = ee.Image(100).toInt().clip(veredasmapbiomasfreq); var mascara2 = ee.Image(200).toInt().clip(arenizacao);
var mascara3 = ee.Image([mascara2, mascara1]) .reduce(ee.Reducer.firstNonNull());
var verd_areniz1 = ee.Image("users/maximomenezesgee/campo_arenizacao_landsat_doutorado_raster") .select('arenizacao_count') .updateMask(mascara3);
var verd_areniz = ee.Image(300).toInt().updateMask(verd_areniz1);
var imagebands1 = ee.Image([ mascara3.updateMask(mascara3.eq(100)), mascara3.updateMask(mascara3.eq(200)) ]).rename('vereda', 'arenizacao');
var mascara4 = ee.Image([verd_areniz, mascara1]) .reduce(ee.Reducer.firstNonNull());
var imagebands2 = ee.Image([ mascara4.updateMask(mascara4.eq(100)), mascara4.updateMask(mascara4.eq(300)) ]).rename('vereda','freq_arenizacao'); print(imagebands2)
Map.addLayer(imagebands1.select('vereda'), { min: 1, max: 200, palette: ['#9400D3', '#4B0082', '#0000FF', '#00FF00', '#FFFF00', '#FF7F00', '#FF0000'] }, 'Arenizacao_freq');
Map.addLayer(imagebands1.select('arenizacao'), { min: 1, max: 200, palette: ['#9400D3', '#4B0082', '#0000FF', '#00FF00', '#FFFF00', '#FF7F00', '#FF0000'] }, 'Arenizacao', null, 0.4);
// Função para calcular a área em hectares var calculateArea = function(image) { var areaImage = image.multiply(ee.Image.pixelArea()).divide(10000); // Convert to hectares var totalArea = areaImage.reduceRegion({ reducer: ee.Reducer.sum(), geometry: geometry, scale: 30, maxPixels: 1e9, bestEffort: true });
- Assistant
- User
fiz to error: .reduce(ee.Reducer.firstNonNull()).rename(['ratio1', 'ratio2'])//
- Assistant
- User
fix to errors: Area Vereda Ratio: Tile error: Too many concurrent aggregations. Area Frequency Arenizacao Ratio: Tile error: Too many concurrent aggregations.
- Assistant
- User
fix to error: Line 186: areaImages.mosaic is not a function
- Assistant