i want to define visualization parameters for maps as codes in main coding space not as import record
for this, i want to calculate the min and max values of image and set them in visualization parameters
i wrote such a code:
var Rectangle = ee.Geometry.Polygon( [[[30.733619384765614,37.77441684925436], [30.9471661376953,37.77441684925436], [30.9471661376953,37.92135417196918], [30.733619384765614,37.92135417196918], [30.733619384765614,37.77441684925436]]], null, false); var Aster = ee.ImageCollection("ASTER/AST_L1T_003"), var Asterbands =['B01','B02','B3N','B04','B05','B06','B07','B08','B09','B10','B11','B12','B13','B14'] Map.setOptions('HYBRID'); Map.centerObject(Rectangle) //+++++++++++++++\\ var AsterImageMosaic= (Aster .filterDate('2000-01-01', '2021-11-01') .select(Asterbands)) .mosaic().clip(Rectangle) print(AsterImageMosaic) Map.addLayer(AsterImageMosaic,{},'Aster Image Mosaic') //+++++band ratio function+++++\\ var Aster_EVI2=AsterImageMosaic.expression( '2.5 * (Aster_3N - Aster_B02) / (Aster_3N + 2.4 * Aster_B02 - 1)',{ 'Aster_3N' : AsterImageMosaic.select('B3N'), 'Aster_B02' : AsterImageMosaic.select('B02') }); Map.centerObject(Rectangle); //+++++++ print('Projection, crs, and crs_transform for EVI:', Aster_EVI2.projection()); print('Projection, crs, and crs_transform for Aster:', AsterImageMosaic.projection()); as the problem in projections i could not able to calculate the min and max values of Aster_EVI2 thus i use the following code to get stat for Aster_EVI2 image (im not sure that is true or not):
var affine = [0.00026949458523585647, 0, -180, 0, -0.00026949458523585647, 86.0000269494563]; var EVI_Min=Aster_EVI2.reduceRegion({ reducer: ee.Reducer.min(), geometry: Rectangle, crs: 'EPSG:4326', crsTransform: affine, maxPixels: 1e9 }); var EVI_Max=(Aster_EVI2.reduceRegion({ reducer: ee.Reducer.max(), geometry: Rectangle, crs: 'EPSG:4326', crsTransform: affine, maxPixels: 1e9 })).values() var EVIMin= EVI_Min.get(0) var EVIMax= EVI_Max.get(0) print('EVI_Min',EVI_Min) print(ee.Number(EVIMax)) var EVIVisParam = { min: -0.5, max: 0.8, palette: ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301'] } Map.addLayer(Aster_EVI2, EVIVisParam, 'Aster EVI'); but i want to apply such coding for visualization parameters so that automatically min max values be utilized in mapping:
var EVIVisParam = { min: EVI_Min, max: EVI_Max, palette: ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301'] } is there any for such adjustments? here is the code scripts:
https://code.earthengine.google.com/?scriptPath=users%2FSolmaz%2FBurdur_Sentinel_CloudFree%3ATest