├── Part A - Applications ├── A1 - Human Applications │ ├── A1.2 Urban Environments │ │ ├── A12a-code.js │ │ ├── A12b-code.js │ │ ├── A12c-code.js │ │ ├── A12d-code.js │ │ ├── A12e-code.js │ │ ├── A12f-code.js │ │ ├── A12g-code.js │ │ ├── A12h-code.js │ │ └── README.md │ ├── A1.3 Built Environments │ │ ├── A13a-code.js │ │ ├── A13b-code.js │ │ ├── A13c-code.js │ │ ├── A13d-code.js │ │ ├── A13e-code.js │ │ ├── A13f-code.js │ │ ├── A32S1-Excercise-1.js │ │ ├── A32S2-Excercise-2.js │ │ └── README.md │ ├── A1.4 Air pollution and population exposure │ │ ├── A14a-code.js │ │ ├── A14b-code.js │ │ ├── A14c-code.js │ │ └── README.md │ ├── A1.5 Heat Islands │ │ ├── A15a-code.js │ │ ├── A15b-code.js │ │ ├── A15c-code.js │ │ ├── A15d-code.js │ │ ├── A15e-code.js │ │ ├── README.md │ │ └── modules │ │ │ ├── ASTER_bare_emiss.js │ │ │ ├── Landsat_LST.js │ │ │ ├── NCEP_TPW.js │ │ │ ├── SMW_coefficients.js │ │ │ ├── SMWalgorithm.js │ │ │ ├── broadband_emiss.js │ │ │ ├── compute_FVC.js │ │ │ ├── compute_NDVI.js │ │ │ ├── compute_emissivity.js │ │ │ └── loudmask.js │ ├── A1.6 Health Applications │ │ ├── A16a-code.js │ │ ├── A16b-code.js │ │ ├── A16c-code.js │ │ ├── A16d-code.js │ │ ├── A16e-code.js │ │ ├── A16f-code.js │ │ ├── A16g-code.js │ │ ├── A16h-code.js │ │ └── README.md │ ├── A1.7 Humanitarian Applications │ │ ├── A17a-code.js │ │ ├── A17b-code.js │ │ ├── A17c-code.js │ │ ├── A17d-code.js │ │ └── README.md │ ├── A1.8 Monitoring Gold Mining Activity using SAR │ │ ├── A18a-code.js │ │ ├── A18b-code.js │ │ ├── A18c-code.js │ │ ├── A18d-code.js │ │ ├── A18e-code.js │ │ ├── README.md │ │ └── modules │ │ │ ├── omnibusTest_v1.1.js │ │ │ └── utilities_v1.1.js │ ├── README.md │ └── ​A1.1 Agricultural Environments │ │ ├── A11a-code.js │ │ ├── A11b-code.js │ │ ├── A11c-code.js │ │ ├── A11d-code.js │ │ └── README.md ├── A2 - Aquatic and Hydrological Applications │ ├── A2.1 Groundwater monitoring with GRACE │ │ ├── A21a-code.js │ │ ├── A21b-code.js │ │ ├── A21c-code.js │ │ ├── A21c2-code.js │ │ ├── A21d-code.js │ │ ├── A21d2-code.js │ │ ├── A21e-code.js │ │ ├── A21e2-code.js │ │ ├── A21f-code.js │ │ ├── A21f2-code.js │ │ ├── A21s1-supplimental-code.js │ │ └── README.md │ ├── A2.2 Benthic Habitats │ │ ├── A22a-code.js │ │ ├── A22b-code.js │ │ ├── A22c-code.js │ │ ├── A22d-code.js │ │ ├── A22e-code.js │ │ └── README.md │ ├── A2.3 Surface Water Mapping │ │ ├── A23a-code.js │ │ ├── A23b-code.js │ │ ├── A23c-code.js │ │ └── README.md │ ├── A2.4 River morphology │ │ ├── A24a-code.js │ │ ├── A24b-code.js │ │ ├── A24c-code.js │ │ ├── A24d-code.js │ │ ├── A24e-code.js │ │ ├── A24f-code.js │ │ └── README.md │ ├── A2.5 Water Balance and Drought │ │ ├── A25a-code.js │ │ ├── A25b-code.js │ │ ├── A25c-code.js │ │ ├── A25d-code.js │ │ ├── A25s1-annual.js │ │ ├── A25s2-PET.js │ │ ├── A25s3-monthly.js │ │ ├── A25s4-per-class-balance.js │ │ └── README.md │ ├── A2.6 Defining Seasonality First Date of No Snow │ │ ├── A26a-code.js │ │ ├── A26b-code.js │ │ └── README.md │ └── README.md ├── A3 - Terrestial Applications │ ├── A3.10 Conservation II - Assessing Agricultural Intensification Near Protected Areas │ │ ├── A310a-code.js │ │ ├── A310b-code.js │ │ ├── A310c-code.js │ │ └── README.md │ ├── A3.2 Mangroves │ │ ├── A32a-code.js │ │ ├── A32b-code.js │ │ ├── A32c-code.js │ │ ├── A32s1-supplemental.js │ │ └── README.md │ ├── A3.3 Mangroves II - Change Mapping │ │ ├── A33a-code.js │ │ ├── A33b-code.js │ │ ├── A33s1-supplemental.js │ │ └── README.md │ ├── A3.4 Forest Degradation and Deforestation │ │ ├── A34a-code.js │ │ ├── A34b-code.js │ │ ├── A34c-code.js │ │ ├── A34d-code.js │ │ ├── A34e-code.js │ │ ├── README.md │ │ └── modules │ │ │ └── palletes.js │ ├── A3.5 Deforestation Viewed from Multiple Sensors │ │ ├── A35a-code.js │ │ ├── A35b-code.js │ │ ├── A35c-code.js │ │ ├── A35d-code.js │ │ ├── A35e-code.js │ │ ├── A35f-code.js │ │ ├── A35g-code.js │ │ ├── README.md │ │ └── modules │ │ │ ├── inputs.js │ │ │ ├── slope_correction_lib.js │ │ │ └── utilites.js │ ├── A3.6 Working With GPS & Weather Data │ │ ├── A36a-code.js │ │ ├── A36b-code.js │ │ └── README.md │ ├── A3.7 Creating Presence and Absence Points │ │ ├── A37a-code.js │ │ ├── A37b-code.js │ │ └── README.md │ ├── A3.8 Detecting Land Cover Change in Rangelands │ │ ├── A38a-code.js │ │ ├── A38b-code.js │ │ ├── A38c-code.js │ │ ├── A38d-code.js │ │ ├── A38e-code.js │ │ ├── README.md │ │ └── modules │ │ │ └── calcResid.js │ ├── A3.9 Conservation I - Assessing the spatial relationship between burned area and precipitation │ │ ├── A39a-code.js │ │ ├── A39b-code.js │ │ ├── A39c-code.js │ │ └── README.md │ ├── README.md │ └── ​A3.1 Active fire monitoring │ │ ├── A31a-code.js │ │ ├── A31b-code.js │ │ ├── A31c-code.js │ │ ├── A31d-code.js │ │ └── README.md └── README.md ├── Part F - Fundamentals ├── F1 - Programming and Remote Sensing Basics │ ├── F1.1 Exploring Images │ │ ├── F11a-code.js │ │ ├── F11b-code.js │ │ ├── F11c-code.js │ │ ├── F11s1-example-4.js │ │ ├── F11s2-example-5.js │ │ └── README.md │ ├── F1.2 Survey of Raster Datasets │ │ ├── F12a-code.js │ │ ├── F12b-code.js │ │ ├── F12c-code.js │ │ ├── F12d-code.js │ │ ├── F12e-code.js │ │ ├── F12f-code.js │ │ ├── F12g-code.js │ │ └── README.md │ ├── F1.3 The Remote Sensing Vocabulary │ │ ├── F13a-code.js │ │ ├── F13b-code.js │ │ ├── F13c-code.js │ │ ├── F13d-code.js │ │ ├── F13e-code.js │ │ └── README.md │ ├── README.md │ └── ​F1.0 JavaScript and the Earth Engine API │ │ ├── F10a-code.js │ │ ├── F10b-code.js │ │ └── README.md ├── F2 - ​Interpreting Images │ ├── F2.1 Interpreting an Image Classification │ │ ├── F21a-code.js │ │ ├── F21b-code.js │ │ ├── F21c-code.js │ │ ├── F21s1-assignment-6.js │ │ └── README.md │ ├── F2.2 Accuracy Assessment Quantifying Classification Quality │ │ ├── F22a-code.js │ │ ├── F22b-code.js │ │ ├── F22c-code.js │ │ └── README.md │ ├── README.md │ └── ​F2.0 Image Manipulation Bands, Arithmetic, Thresholds, and Masks │ │ ├── F20a-code.js │ │ ├── F20b-code.js │ │ └── README.md ├── F3 - Advanced Image Processing │ ├── F3.1 Advanced Pixel-based Image Transformation │ │ ├── F31a-code.js │ │ ├── F31b-code.js │ │ ├── F31c-code.js │ │ └── README.md │ ├── F3.2 Neighborhood-based Image Transformation │ │ ├── F32a-code.js │ │ ├── F32b-code.js │ │ ├── F32c-code.js │ │ ├── F32d-code.js │ │ └── README.md │ ├── F3.3 Object-based Image Analysis │ │ ├── F33a-code.js │ │ ├── F33b-code.js │ │ ├── F33c-code.js │ │ ├── F33d-code.js │ │ ├── F33s1-additional-image.js │ │ └── README.md │ ├── README.md │ └── ​F3.0 Interpreting an Image Regression │ │ ├── F30a-code.js │ │ ├── F30b-code.js │ │ ├── F30c-code.js │ │ └── README.md ├── F4 - ​Interpreting Image Series │ ├── F4.1 Exploring Image Collections │ │ ├── F41a-code.js │ │ ├── F41b-code.js │ │ ├── F41c-code.js │ │ ├── F41d-code.js │ │ └── README.md │ ├── F4.2 Aggregating Images for Time Series │ │ ├── F42a-code.js │ │ ├── F42b-code.js │ │ ├── F42c-code.js │ │ ├── F42d-code.js │ │ └── README.md │ ├── F4.3 Clouds and Image Compositing │ │ ├── F43a-code.js │ │ ├── F43b-code.js │ │ ├── F43c-code.js │ │ ├── F43d-code.js │ │ └── README.md │ ├── F4.4 Change Detection │ │ ├── F44a-code.js │ │ ├── F44b-code.js │ │ ├── README.md │ │ └── vis │ │ │ ├── incheon.js │ │ │ ├── mining.js │ │ │ ├── mtSHelen.js │ │ │ └── paradise.js │ ├── F4.5 Interpreting Annual Time Series with LandTrendr │ │ ├── F45a-code.js │ │ └── README.md │ ├── F4.6 Fitting Functions to Time Series │ │ ├── F46a-code.js │ │ ├── F46b-code.js │ │ ├── F46c-code.js │ │ ├── F46d-code.js │ │ ├── F46e-code.js │ │ ├── F46s1-Synthesis.js │ │ ├── F46s2-Synthesis.js │ │ └── README.md │ ├── F4.7 Interpreting Time Series with CCDC │ │ ├── F47a-code.js │ │ ├── F47b-code.js │ │ ├── F47c-code.js │ │ ├── F47d-code.js │ │ ├── F47e-code.js │ │ └── README.md │ ├── F4.8 Data Fusion Merging Classification Streams │ │ ├── F48a-code.js │ │ ├── F48b-code.js │ │ ├── F48c-code.js │ │ ├── F48s1-suplemental.js │ │ └── README.md │ ├── F4.9 Exploring Lagged Effects in Time Series │ │ ├── F49a-code.js │ │ ├── F49b-code.js │ │ ├── F49c-code.js │ │ ├── F49d-code.js │ │ └── README.md │ ├── README.md │ └── ​F4.0 Filter, Map, Reduce │ │ ├── F40a-code.js │ │ ├── F40b-code.js │ │ ├── F40c-code.js │ │ └── README.md ├── F5 - ​Vectors and Tables │ ├── F5.1 RasterVector Conversions │ │ ├── F51a-code.js │ │ ├── F51b-code.js │ │ ├── F51c-code.js │ │ ├── F51d-code.js │ │ ├── F51e-code.js │ │ └── README.md │ ├── F5.2 Zonal Statistics │ │ ├── F52a-code.js │ │ ├── F52b-code.js │ │ ├── F52c-code.js │ │ └── README.md │ ├── F5.3 Advanced Vector Operations │ │ ├── F53a-code.js │ │ ├── F53b-code.js │ │ └── README.md │ ├── F5.4 GEEDiT Digitising from satellite imagery │ │ ├── F54a-code.js │ │ └── README.md │ ├── README.md │ └── ​F5.0 Exploring Vectors │ │ ├── F50a-code.js │ │ ├── F50b-code.js │ │ ├── F50c-code.js │ │ ├── F50d-code.js │ │ ├── F50e-code.js │ │ └── README.md ├── F6 - ​Advanced Topics │ ├── F6.1 Collaborating in Earth Engine with Scripts and Assets │ │ ├── F61a-code.js │ │ └── README.md │ ├── F6.2 Scaling up in Earth Engine │ │ ├── F62a-code.js │ │ ├── F62b-code.js │ │ ├── F63c-code.js │ │ ├── F63d-code.js │ │ ├── F63e-code.js │ │ ├── README.md │ │ └── modules │ │ │ └── s2cloudmask.js │ ├── F6.3 Sharing Work in Earth Engine Basic UI and Apps │ │ ├── F63a-code.js │ │ ├── F63b-code.js │ │ ├── F63c-code.js │ │ ├── F63d-code.js │ │ └── README.md │ ├── F6.4 Combining R and Earth Engine │ │ ├── F64a-code.js │ │ ├── F64b-code.js │ │ ├── F64c-code.js │ │ ├── F64d-code.js │ │ ├── F64e-code.js │ │ ├── F64f-code.js │ │ ├── F64g-code.js │ │ └── README.md │ ├── README.md │ └── ​​F6.0 Advanced Raster Visualization │ │ ├── F60a-code.js │ │ ├── F60b-code.js │ │ ├── F60c-code.js │ │ ├── F60d-code.js │ │ ├── F60e-code.js │ │ ├── F60f-code.js │ │ ├── F60g-code.js │ │ ├── F60h-code.js │ │ ├── F60i-code.js │ │ ├── F60j-code.js │ │ ├── F60s1-supplemental.js │ │ └── README.md └── README.md ├── README.md ├── gee-tutorials.jpg └── logo.png /Part A - Applications/A1 - Human Applications/A1.2 Urban Environments/A12a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A1.2 Urban Environments 3 | // Checkpoint: A12a 4 | // Authors: Michelle Stuhlmacher and Ran Goldblatt 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | Map.centerObject(geometry); 7 | 8 | // Filter collection. 9 | var collection = L8 10 | .filterBounds(geometry) 11 | .filterDate('2010-01-01', '2020-12-31') 12 | .filter(ee.Filter.lte('CLOUD_COVER_LAND', 3)); 13 | 14 | // Define GIF visualization arguments. 15 | var gifParams = { 16 | bands: ['SR_B4', 'SR_B3', 'SR_B2'], 17 | min: 0.07 * 65536, 18 | max: 0.3 * 65536, 19 | region: geometry, 20 | framesPerSecond: 15, 21 | format: 'gif' 22 | }; 23 | 24 | // Render the GIF animation in the console. 25 | print(ui.Thumbnail(collection, gifParams)); 26 | 27 | // ----------------------------------------------------------------------- 28 | // CHECKPOINT 29 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/A1.2 Urban Environments/A12b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A1.2 Urban Environments 3 | // Checkpoint: A12b 4 | // Authors: Michelle Stuhlmacher and Ran Goldblatt 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // MODIS (Accra) 8 | // Center over Accra. 9 | Map.setCenter(-0.2264, 5.5801, 10); 10 | 11 | // Visualize the full classification. 12 | var MODIS_lc = MODIS.select('LC_Type1'); 13 | var igbpLandCoverVis = { 14 | min: 1.0, 15 | max: 17.0, 16 | palette: ['05450a', '086a10', '54a708', '78d203', '009900', 17 | 'c6b044', 'dcd159', 'dade48', 'fbff13', 'b6ff05', 18 | '27ff87', 'c24f44', 'a5a5a5', 'ff6d4c', '69fff8', 19 | 'f9ffa4', '1c0dff' 20 | ], 21 | }; 22 | Map.addLayer(MODIS_lc, igbpLandCoverVis, 'IGBP Land Cover'); 23 | 24 | // Visualize the urban extent in 2001 and 2019. 25 | // 2019 26 | var MODIS_2019 = MODIS_lc.filterDate(ee.Date('2019-01-01')); 27 | 28 | var M_urb_2019 = MODIS_2019.mosaic().eq(13); 29 | Map.addLayer(M_urb_2019.mask(M_urb_2019), { 30 | 'palette': 'FF0000' 31 | }, 'MODIS Urban 2019'); 32 | 33 | var MODIS_2001 = MODIS_lc.filterDate(ee.Date('2001-01-01')); 34 | var M_urb_2001 = MODIS_2001.mosaic().eq(13); 35 | Map.addLayer(M_urb_2001.mask(M_urb_2001), { 36 | 'palette': 'a5a5a5' 37 | }, 'MODIS Urban 2001'); 38 | 39 | // ----------------------------------------------------------------------- 40 | // CHECKPOINT 41 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/A1.2 Urban Environments/A12c-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A1.2 Urban Environments 3 | // Checkpoint: A12c 4 | // Authors: Michelle Stuhlmacher and Ran Goldblatt 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // CORINE (London) 8 | // Center over London 9 | Map.setCenter(-0.1795, 51.4931, 10); 10 | 11 | // Visualize the urban extent in 2000 and 2018. 12 | // 2018 (2017-2018) 13 | var CORINE_2018 = CORINE.select('landcover').filterDate(ee.Date( 14 | '2017-01-01')); 15 | 16 | var C_urb_2018 = CORINE_2018.mosaic().lte(133); //Select urban areas 17 | Map.addLayer(C_urb_2018.mask(C_urb_2018), { 18 | 'palette': 'FF0000' 19 | }, 'CORINE Urban 2018'); 20 | 21 | // 2000 (1999-2001) 22 | var CORINE_2000 = CORINE.select('landcover').filterDate(ee.Date( 23 | '1999-01-01')); 24 | var C_urb_2000 = CORINE_2000.mosaic().lte(133); //Select urban areas 25 | Map.addLayer(C_urb_2000.mask(C_urb_2000), { 26 | 'palette': 'a5a5a5' 27 | }, 'CORINE Urban 2000'); 28 | 29 | // ----------------------------------------------------------------------- 30 | // CHECKPOINT 31 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/A1.2 Urban Environments/A12d-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A1.2 Urban Environments 3 | // Checkpoint: A12d 4 | // Authors: Michelle Stuhlmacher and Ran Goldblatt 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // NLCD (Chicago) 8 | // Center over Chicago. 9 | Map.setCenter(-87.6324, 41.8799, 10); 10 | 11 | // Select the land cover band. 12 | var NLCD_lc = NLCD.select('landcover'); 13 | 14 | // Filter NLCD collection to 2016. 15 | var NLCD_2016 = NLCD_lc.filter(ee.Filter.eq('system:index', '2016')) 16 | .first(); 17 | Map.addLayer(NLCD_2016, {}, 'NLCD 2016'); 18 | 19 | // Calculate the total area of the 'Developed high intensity' class (24) in Chicago. 20 | var Chicago = ee.FeatureCollection( 21 | 'projects/gee-book/assets/A1-2/Chicago'); 22 | 23 | // Clip classification to Chicago 24 | var NLCD_2016_chi = NLCD_2016.clip(Chicago); 25 | 26 | // Set class 24 pixels to 1 and mask the rest. 27 | var NLCD_2016_chi_24 = NLCD_2016_chi.eq(24).selfMask(); 28 | Map.addLayer(NLCD_2016_chi_24, {}, 29 | 'Chicago developed high intensity'); 30 | 31 | // Area calculation. 32 | var areaDev = NLCD_2016_chi_24.multiply(ee.Image.pixelArea()) 33 | .reduceRegion({ 34 | reducer: ee.Reducer.sum(), 35 | geometry: Chicago.geometry(), 36 | scale: 30 37 | }) 38 | .get('landcover'); 39 | print(areaDev); 40 | 41 | // ----------------------------------------------------------------------- 42 | // CHECKPOINT 43 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/A1.2 Urban Environments/A12e-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A1.2 Urban Environments 3 | // Checkpoint: A12e 4 | // Authors: Michelle Stuhlmacher and Ran Goldblatt 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Surface reflectance function from example: 8 | function maskL457sr(image) { 9 | var qaMask = image.select('QA_PIXEL').bitwiseAnd(parseInt('11111', 10 | 2)).eq(0); 11 | var saturationMask = image.select('QA_RADSAT').eq(0); 12 | 13 | // Apply the scaling factors to the appropriate bands. 14 | var opticalBands = image.select('SR_B.').multiply(0.0000275).add(- 15 | 0.2); 16 | var thermalBand = image.select('ST_B6').multiply(0.00341802).add( 17 | 149.0); 18 | 19 | // Replace the original bands with the scaled ones and apply the masks. 20 | return image.addBands(opticalBands, null, true) 21 | .addBands(thermalBand, null, true) 22 | .updateMask(qaMask) 23 | .updateMask(saturationMask); 24 | } 25 | 26 | // Map the function over one year of data. 27 | var collection = L7.filterDate('2020-01-01', '2021-01-01').map( 28 | maskL457sr); 29 | var landsat7_2020 = collection.median(); 30 | 31 | Map.addLayer(landsat7_2020, { 32 | bands: ['SR_B3', 'SR_B2', 'SR_B1'], 33 | min: 0, 34 | max: 0.3 35 | }, 'landsat 7, 2020'); 36 | 37 | // ----------------------------------------------------------------------- 38 | // CHECKPOINT 39 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/A1.2 Urban Environments/A12f-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A1.2 Urban Environments 3 | // Checkpoint: A12f 4 | // Authors: Michelle Stuhlmacher and Ran Goldblatt 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | Map.centerObject(bu, 13); 7 | 8 | // Surface reflectance function from example: 9 | function maskL457sr(image) { 10 | var qaMask = image.select('QA_PIXEL').bitwiseAnd(parseInt('11111', 11 | 2)).eq(0); 12 | var saturationMask = image.select('QA_RADSAT').eq(0); 13 | 14 | // Apply the scaling factors to the appropriate bands. 15 | var opticalBands = image.select('SR_B.').multiply(0.0000275).add(- 16 | 0.2); 17 | var thermalBand = image.select('ST_B6').multiply(0.00341802).add( 18 | 149.0); 19 | 20 | // Replace the original bands with the scaled ones and apply the masks. 21 | return image.addBands(opticalBands, null, true) 22 | .addBands(thermalBand, null, true) 23 | .updateMask(qaMask) 24 | .updateMask(saturationMask); 25 | } 26 | 27 | // Map the function over one year of data. 28 | var collection = L7.filterDate('2020-01-01', '2021-01-01').map( 29 | maskL457sr); 30 | var landsat7_2020 = collection.median(); 31 | 32 | Map.addLayer(landsat7_2020, { 33 | bands: ['SR_B3', 'SR_B2', 'SR_B1'], 34 | min: 0, 35 | max: 0.3 36 | }, 'landsat 7, 2020'); 37 | 38 | // ----------------------------------------------------------------------- 39 | // CHECKPOINT 40 | // ----------------------------------------------------------------------- 41 | 42 | var lc = nbu.merge(bu); 43 | 44 | // ----------------------------------------------------------------------- 45 | // CHECKPOINT 46 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/A1.3 Built Environments/A13d-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A1.3 Built Environments 3 | // Checkpoint: A13d 4 | // Author: Erin Trochim 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Import roads data. 8 | var grip4_africa = ee.FeatureCollection( 9 | 'projects/sat-io/open-datasets/GRIP4/Africa'), 10 | grip4_europe = ee.FeatureCollection( 11 | 'projects/sat-io/open-datasets/GRIP4/Europe'), 12 | grip4_north_america = ee.FeatureCollection( 13 | 'projects/sat-io/open-datasets/GRIP4/North-America'); 14 | 15 | // Add a function to add line length in km. 16 | var addLength = function(feature) { 17 | return feature.set({ 18 | lengthKm: feature.length().divide(1000) 19 | }); // km; 20 | }; 21 | 22 | // Calculate line lengths for all roads in Africa. 23 | var grip4_africaLength = grip4_africa.map(addLength); 24 | 25 | // Convert the roads to raster. 26 | var empty = ee.Image().float(); 27 | 28 | var grip4_africaRaster = empty.paint({ 29 | featureCollection: grip4_africaLength, 30 | color: 'lengthKm' 31 | }); 32 | 33 | // Import simplified countries. 34 | var countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017'); 35 | 36 | // Filter to Africa. 37 | var Africa = countries.filter(ee.Filter.eq('wld_rgn', 'Africa')); 38 | 39 | // Import global power transmission lines. 40 | var transmission = ee.FeatureCollection( 41 | 'projects/sat-io/open-datasets/predictive-global-power-system/distribution-transmission-lines' 42 | ); 43 | 44 | // Filter transmission lines to Africa. 45 | var transmissionAfrica = transmission.filterBounds(Africa); 46 | 47 | // Calculate line lengths for all transmission lines in Africa. 48 | var transmissionAfricaLength = transmissionAfrica.map(addLength); 49 | 50 | // Convert the transmission lines to raster. 51 | var transmissionAfricaRaster = empty.paint({ 52 | featureCollection: transmissionAfricaLength, 53 | color: 'lengthKm' 54 | }); 55 | 56 | // ----------------------------------------------------------------------- 57 | // CHECKPOINT 58 | // ----------------------------------------------------------------------- 59 | -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/A1.3 Built Environments/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | # Part A1: Human Applications 30 | 31 | This Part covers some of the many Human Applications of Earth Engine. It includes demonstrations of how Earth Engine can be used in agricultural and urban settings, including for sensing the built environment and the effects it has on air composition and temperature. This Part also covers the complex topics of human health, illicit deforestation activity, and humanitarian actions. 32 | 33 | 34 | # Chapter A1.3: Built Environments 35 | 36 | ## Author 37 | Erin Trochim 38 | 39 | 40 | 41 | ## Overview 42 | The built environment consists of the human-made physical parts of the environment, including homes, buildings, streets, open spaces, and infrastructure. This chapter will focus on analyzing global infrastructure datasets. 43 | 44 | 45 | ## Learning Outcomes 46 | - Quantifying road characteristics. 47 | - Comparing road and transmission line distributions. 48 | - Contrasting changes in impervious surfaces with flooding. 49 | - Understanding vector-based versus raster-based approaches. 50 | 51 | ## Link for details: 52 | https://google-earth-engine.com/Human-Applications/Built-Environments/ 53 | 54 | # Invitation for collaborators: 55 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 56 | 57 | https://google-earth-engine.com/contact/ 58 | -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/A1.5 Heat Islands/A15a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A1.5 Heat Islands 3 | // Checkpoint: A15a 4 | // Author: TC Chakraborty 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Load feature collection of New Haven's census tracts from user assets. 8 | var regionInt = ee.FeatureCollection( 9 | 'projects/gee-book/assets/A1-5/TC_NewHaven'); 10 | 11 | // Get dissolved feature collection using an error margin of 50 meters. 12 | var regionInt = regionInt.union(50); 13 | 14 | // Set map center and zoom level (Zoom level varies from 1 to 20). 15 | Map.setCenter(-72.9, 41.3, 12); 16 | 17 | // Add layer to map. 18 | Map.addLayer(regionInt, {}, 'New Haven boundary'); 19 | 20 | // Load MODIS image collection from the Earth Engine data catalog. 21 | var modisLst = ee.ImageCollection('MODIS/006/MYD11A2'); 22 | 23 | // Select the band of interest (in this case: Daytime LST). 24 | var landSurfTemperature = modisLst.select('LST_Day_1km'); 25 | 26 | // Create a summer filter. 27 | var sumFilter = ee.Filter.dayOfYear(152, 243); 28 | 29 | // Filter the date range of interest using a date filter. 30 | var lstDateInt = landSurfTemperature 31 | .filterDate('2014-01-01', '2019-01-01').filter(sumFilter); 32 | 33 | // Take pixel-wise mean of all the images in the collection. 34 | var lstMean = lstDateInt.mean(); 35 | 36 | // Multiply each pixel by scaling factor to get the LST values. 37 | var lstFinal = lstMean.multiply(0.02); 38 | 39 | // Generate a water mask. 40 | var water = ee.Image('JRC/GSW1_0/GlobalSurfaceWater').select( 41 | 'occurrence'); 42 | var notWater = water.mask().not(); 43 | 44 | // Clip data to region of interest, convert to degree Celsius, and mask water pixels. 45 | var lstNewHaven = lstFinal.clip(regionInt).subtract(273.15) 46 | .updateMask(notWater); 47 | 48 | // Add layer to map. 49 | Map.addLayer(lstNewHaven, { 50 | palette: ['blue', 'white', 'red'], 51 | min: 25, 52 | max: 38 53 | }, 54 | 'LST_MODIS'); 55 | 56 | // ----------------------------------------------------------------------- 57 | // CHECKPOINT 58 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/A1.5 Heat Islands/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | # Part A1: Human Applications 30 | 31 | This Part covers some of the many Human Applications of Earth Engine. It includes demonstrations of how Earth Engine can be used in agricultural and urban settings, including for sensing the built environment and the effects it has on air composition and temperature. This Part also covers the complex topics of human health, illicit deforestation activity, and humanitarian actions. 32 | 33 | # Chapter A1.5: Heat Islands 34 | 35 | ## Author 36 | TC Chakraborty 37 | 38 | 39 | ## Overview 40 | In this chapter, you will learn about urban heat islands and how they can be calculated from satellite measurements of thermal radiation from the Earth’s surface. 41 | 42 | ## Learning Outcomes 43 | - Understanding how to derive land surface temperature. 44 | - Understanding how to generate urban and rural references. 45 | - Knowing how to calculate the surface urban heat island intensity. 46 | 47 | ## Link for details: 48 | https://google-earth-engine.com/Human-Applications/Heat-Islands/ 49 | 50 | # Invitation for collaborators: 51 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 52 | 53 | https://google-earth-engine.com/contact/ 54 | -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/A1.5 Heat Islands/modules/compute_FVC.js: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Sofia Ermida (sofia.ermida@ipma.pt; @ermida_sofia) 3 | 4 | This code is free and open. 5 | By using this code and any data derived with it, 6 | you agree to cite the following reference 7 | in any publications derived from them: 8 | Ermida, S.L., Soares, P., Mantas, V., Göttsche, F.-M., Trigo, I.F., 2020. 9 | Google Earth Engine open-source code for Land Surface Temperature estimation from the Landsat series. 10 | Remote Sensing, 12 (9), 1471; https://doi.org/10.3390/rs12091471 11 | 12 | this function computes the Fraction of Vegetation Cover from NDVI 13 | the compute_NDVI.js function must be called before this one 14 | 15 | to call this function use: 16 | 17 | var FVCfun = require('users/sofiaermida/landsat_smw_lst:modules/compute_FVC.js') 18 | var ImagewithFVC = FVCfun.addBand(landsat)(image) 19 | or 20 | var collectionwithFVC = ImageCollection.map(FVCfun.addBand(landsat)) 21 | 22 | USES: 23 | - SMW_coefficients.js 24 | 25 | INPUTS: 26 | - landsat: 27 | the Landsat satellite id 28 | valid inputs: 'L4', 'L5', 'L7' and 'L8' 29 | - image: 30 | image for which to calculate the FVC 31 | OUTPUTS: 32 | - 33 | the input image with 1 new band: 34 | 'FVC': fraction of vegetation cover 35 | */ 36 | exports.addBand = function(landsat){ 37 | var wrap = function(image){ 38 | 39 | var ndvi = image.select('NDVI') 40 | 41 | // Compute FVC 42 | var fvc = image.expression('((ndvi-ndvi_bg)/(ndvi_vg - ndvi_bg))**2', 43 | {'ndvi':ndvi,'ndvi_bg':0.2,'ndvi_vg':0.86}); 44 | fvc = fvc.where(fvc.lt(0.0),0.0); 45 | fvc = fvc.where(fvc.gt(1.0),1.0); 46 | 47 | return image.addBands(fvc.rename('FVC')); 48 | } 49 | return wrap 50 | }; -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/A1.5 Heat Islands/modules/compute_NDVI.js: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Sofia Ermida (sofia.ermida@ipma.pt; @ermida_sofia) 3 | 4 | this function computes NDVI values for Landsat 5 | 6 | 7 | to call this function use: 8 | 9 | var NDVIfun = require('users/sofiaermida/landsat_smw_lst:modules/compute_NDVI.js') 10 | var ImagewithNDVI = NDVIfun.addBand(landsat)(image) 11 | or 12 | var collectionwithNDVI = ImageCollection.map(NDVIfun.addBand(landsat)) 13 | 14 | INPUTS: 15 | - landsat: 16 | the Landsat satellite id 17 | valid inputs: 'L4', 'L5', 'L7' and 'L8' 18 | - image: 19 | image for which to calculate the NDVI 20 | OUTPUTS: 21 | - 22 | the input image with 1 new band: 23 | 'NDVI': normalized difference vegetation index 24 | */ 25 | 26 | exports.addBand = function(landsat){ 27 | var wrap = function(image){ 28 | 29 | // choose bands 30 | var nir = ee.String(ee.Algorithms.If(landsat==='L8','B5','B4')) 31 | var red = ee.String(ee.Algorithms.If(landsat==='L8','B4','B3')) 32 | 33 | // compute NDVI 34 | return image.addBands(image.expression('(nir-red)/(nir+red)',{ 35 | 'nir':image.select(nir).multiply(0.0001), 36 | 'red':image.select(red).multiply(0.0001) 37 | }).rename('NDVI')) 38 | } 39 | return wrap 40 | }; -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/A1.5 Heat Islands/modules/loudmask.js: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Sofia Ermida (sofia.ermida@ipma.pt; @ermida_sofia) 3 | 4 | this function mask clouds and cloud shadow using the Quality band 5 | 6 | to call this function use: 7 | 8 | var cloudmask = require('users/sofiaermida/landsat_smw_lst:modules/cloudmask.js') 9 | var TOAImageMasked = cloudmask.toa(image) 10 | var SRImageMasked = cloudmask.sr(image) 11 | or 12 | var TOAcollectionMasked = ImageCollection.map(cloudmask.toa) 13 | var SRcollectionMasked = ImageCollection.map(cloudmask.sr) 14 | 15 | 16 | INPUTS: 17 | - image: 18 | image for which clouds are masked 19 | OUTPUTS: 20 | - 21 | the input image with updated mask 22 | */ 23 | 24 | 25 | // cloudmask for TOA data 26 | exports.toa = function(image) { 27 | var qa = image.select('BQA'); 28 | var mask = qa.bitwiseAnd(1 << 4).eq(0); 29 | return image.updateMask(mask); 30 | }; 31 | 32 | // cloudmask for SR data 33 | exports.sr = function(image) { 34 | var qa = image.select('pixel_qa'); 35 | var mask = qa.bitwiseAnd(1 << 3) 36 | .or(qa.bitwiseAnd(1 << 5)) 37 | return image.updateMask(mask.not()); 38 | }; -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/A1.6 Health Applications/A16a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A1.6 Health Applications 3 | // Checkpoint: A16a 4 | // Author: Dawn Nekorchuk 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Section 1: Data Import 8 | var woredas = ee.FeatureCollection( 9 | 'projects/gee-book/assets/A1-6/amhara_woreda_20170207'); 10 | // Create region outer boundary to filter products on. 11 | var amhara = woredas.geometry().bounds(); 12 | var gpm = ee.ImageCollection('NASA/GPM_L3/IMERG_V06'); 13 | var LSTTerra8 = ee.ImageCollection('MODIS/061/MOD11A2') 14 | // Due to MCST outage, only use dates after this for this script. 15 | .filterDate('2001-06-26', Date.now()); 16 | var brdfReflect = ee.ImageCollection('MODIS/006/MCD43A4'); 17 | var brdfQa = ee.ImageCollection('MODIS/006/MCD43A2'); 18 | 19 | // Visualize woredas with black borders and no fill. 20 | // Create an empty image into which to paint the features, cast to byte. 21 | var empty = ee.Image().byte(); 22 | // Paint all the polygon edges with the same number and width. 23 | var outline = empty.paint({ 24 | featureCollection: woredas, 25 | color: 1, 26 | width: 1 27 | }); 28 | // Add woreda boundaries to the map. 29 | Map.setCenter(38, 11.5, 7); 30 | Map.addLayer(outline, { 31 | palette: '000000' 32 | }, 'Woredas'); 33 | 34 | // ----------------------------------------------------------------------- 35 | // CHECKPOINT 36 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/A1.8 Monitoring Gold Mining Activity using SAR/A18a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A1.8 Monitoring Gold Mining Activity using SAR 3 | // Checkpoint: A18a 4 | // Authors: Lucio Villa, Sidney Novoa, Milagros Becerra, 5 | // Andréa Puzzi Nicolau, Karen Dyson, Karis Tenneson, John Dilger 6 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 | 8 | ////////////////////////////////////////////////////// 9 | /// Section One 10 | ////////////////////////////////////////////////////// 11 | 12 | // Define the area of study. 13 | var aoi = ee.FeatureCollection('projects/gee-book/assets/A1-8/mdd'); 14 | 15 | // Center the map at the aoi. 16 | Map.centerObject(aoi, 9); 17 | 18 | // Create an empty image. 19 | var empty = ee.Image().byte(); 20 | 21 | // Convert the area of study to an EE image object 22 | // so we can visualize only the boundary. 23 | var aoiOutline = empty.paint({ 24 | featureCollection: aoi, 25 | color: 1, 26 | width: 2 27 | }); 28 | 29 | // Select the satellite basemap view. 30 | Map.setOptions('SATELLITE'); 31 | 32 | // Add the area of study boundary to the map. 33 | Map.addLayer(aoiOutline, { 34 | palette: 'red' 35 | }, 'Area of Study'); 36 | 37 | // Function to mask the SAR images acquired with an incidence angle 38 | // lower or equal to 31 and greater or equal to 45 degrees. 39 | function maskAngle(image) { 40 | var angleMask = image.select('angle'); 41 | return image.updateMask(angleMask.gte(31).and(angleMask.lte(45))); 42 | } 43 | 44 | // Function to get the SAR Collection. 45 | function getCollection(dates, roi, orbitPass0) { 46 | var sarCollFloat = ee.ImageCollection('COPERNICUS/S1_GRD_FLOAT') 47 | .filterBounds(roi) 48 | .filterDate(dates[0], dates[1]) 49 | .filter(ee.Filter.eq('orbitProperties_pass', orbitPass0)); 50 | return sarCollFloat.map(maskAngle).select(['VV', 'VH']); 51 | } 52 | 53 | // Define variables: the period of time and the orbitpass. 54 | var listOfDates = ['2021-08-01', '2021-08-12']; 55 | var orbitPass = 'DESCENDING'; 56 | 57 | // Apply the function to get the SAR mosaic. 58 | var sarImageColl = getCollection(listOfDates, aoi, orbitPass) 59 | .mosaic() 60 | .clip(aoi); 61 | print('SAR Image Mosaic', sarImageColl); 62 | 63 | // Apply logarithmic scale. 64 | var sarImageScaled = sarImageColl.log10().multiply(10.0); 65 | 66 | // Visualize results. 67 | var sarVis = { 68 | bands: ['VV', 'VH', 'VV'], 69 | min: [-18, -23, 3], 70 | max: [-4, -11, 15] 71 | }; 72 | Map.addLayer(sarImageScaled, sarVis, 'Sentinel-1 / SAR Mosaic'); 73 | 74 | // ----------------------------------------------------------------------- 75 | // CHECKPOINT 76 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/A1.8 Monitoring Gold Mining Activity using SAR/A18b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A1.8 Monitoring Gold Mining Activity using SAR 3 | // Checkpoint: A18b 4 | // Authors: Lucio Villa, Sidney Novoa, Milagros Becerra, 5 | // Andréa Puzzi Nicolau, Karen Dyson, Karis Tenneson, John Dilger 6 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 | 8 | ////////////////////////////////////////////////////// 9 | /// Section Two 10 | ////////////////////////////////////////////////////// 11 | 12 | // Define the area of study. 13 | var aoi = ee.FeatureCollection('projects/gee-book/assets/A1-8/mdd'); 14 | 15 | // Center the map at the aoi. 16 | Map.centerObject(aoi, 9); 17 | 18 | // Create an empty image. 19 | var empty = ee.Image().byte(); 20 | 21 | // Convert the area of study to an EE image object 22 | // so we can visualize only the boundary. 23 | var aoiOutline = empty.paint({ 24 | featureCollection: aoi, 25 | color: 1, 26 | width: 2 27 | }); 28 | 29 | // Select the satellite basemap view. 30 | Map.setOptions('SATELLITE'); 31 | 32 | // Add the area of study boundary to the map. 33 | Map.addLayer(aoiOutline, { 34 | palette: 'red' 35 | }, 'Area of Study'); 36 | 37 | // Function to mask the SAR images acquired with an incidence angle 38 | // lower equal than 31 and greater equal than 45 degrees. 39 | function maskAngle(image) { 40 | var angleMask = image.select('angle'); 41 | return image.updateMask(angleMask.gte(31).and(angleMask.lte(45))); 42 | } 43 | 44 | // Function to get the SAR Collection. 45 | function getCollection(dates, roi, orbitPass0) { 46 | var sarCollFloat = ee.ImageCollection('COPERNICUS/S1_GRD_FLOAT') 47 | .filterBounds(roi) 48 | .filterDate(dates[0], dates[1]) 49 | .filter(ee.Filter.eq('orbitProperties_pass', orbitPass0)); 50 | return sarCollFloat.map(maskAngle).select(['VV', 'VH']); 51 | } 52 | 53 | // Define variables: the period of time and the orbitpass. 54 | var listOfDates = ['2021-01-01', '2022-01-01']; 55 | var orbitPass = 'DESCENDING'; 56 | 57 | // Apply the function to get the SAR Collection. 58 | var sarImageColl = getCollection(listOfDates, aoi, orbitPass); 59 | print('SAR Image Collection', sarImageColl); 60 | 61 | // ----------------------------------------------------------------------- 62 | // CHECKPOINT 63 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A1 - Human Applications/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | # Part A1: Human Applications 30 | 31 | This Part covers some of the many Human Applications of Earth Engine. It includes demonstrations of how Earth Engine can be used in agricultural and urban settings, including for sensing the built environment and the effects it has on air composition and temperature. This Part also covers the complex topics of human health, illicit deforestation activity, and humanitarian actions. 32 | 33 | https://google-earth-engine.com/Human-Applications/Agricultural-Environments/ 34 | 35 | # Invitation for collaborators: 36 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 37 | 38 | https://google-earth-engine.com/contact/ 39 | -------------------------------------------------------------------------------- /Part A - Applications/A2 - Aquatic and Hydrological Applications/A2.1 Groundwater monitoring with GRACE/A21a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A2.1 Groundwater Monitoring with GRACE 3 | // Checkpoint: A21a 4 | // Authors: A.J. Purdy, J.S. Famiglietti 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Import Basins. 8 | var basins = ee.FeatureCollection('USGS/WBD/2017/HUC04'); 9 | 10 | // Extract the 3 HUC 04 basins for the Central Valley. 11 | var codes = ['1802', '1803', '1804']; 12 | var basin = basins.filter(ee.Filter.inList('huc4', codes)); 13 | 14 | // Add the basin to the map to show the extent of our analysis. 15 | Map.centerObject(basin, 6); 16 | Map.addLayer(basin, { 17 | color: 'green' 18 | }, 'Central Valley Basins', true, 0.5); 19 | 20 | var landcover = ee.ImageCollection('USDA/NASS/CDL') 21 | .filter(ee.Filter.date('2019-01-01', '2019-12-31')) 22 | .select('cultivated'); 23 | 24 | Map.addLayer(landcover.first().clip(basin), {}, 'Cropland', true, 25 | 0.5); 26 | 27 | // This table was generated using the index from the CDEC website 28 | var res = ee.FeatureCollection( 29 | 'projects/gee-book/assets/A2-1/ca_reservoirs_index'); 30 | // Filter reservoir locations by the Central Valley geometry 31 | var res_cv = res.filterBounds(basin); 32 | Map.addLayer(res_cv, { 33 | 'color': 'blue' 34 | }, 'Reservoirs'); 35 | 36 | // ----------------------------------------------------------------------- 37 | // CHECKPOINT 38 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A2 - Aquatic and Hydrological Applications/A2.1 Groundwater monitoring with GRACE/A21s1-supplimental-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A2.1 Groundwater Monitoring with GRACE 3 | // Section: Section 3 (A21s1 - Supplemental) 4 | // Authors: A.J. Purdy, J.S. Famiglietti 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // The basins feature is being used to subset GLDAS geographically 8 | // The first 7 lines are set for California. 9 | // A user will need to adjust the basin to reflect another region 10 | var basins = ee.FeatureCollection('USGS/WBD/2017/HUC04'); 11 | // Extract the 3 HUC 04 basins for the Central Valley. 12 | var codes = ['1802', '1803', '1804']; 13 | var basin = basins.filter(ee.Filter.inList('huc4', codes)); 14 | 15 | // Set start / end year. 16 | var yrStart = 2003; 17 | var yrEnd = 2016; 18 | var years = ee.List.sequence(yrStart, yrEnd); 19 | 20 | // The varBand variable is set to evaluated Snow Water Equivalent. 21 | // Need to adjust to export Soil Moisture (SM_inst) 22 | var varBand = 'SWE_inst'; 23 | 24 | var waterstorage = ee.ImageCollection('NASA/GLDAS/V021/NOAH/G025/T3H') 25 | .select(varBand) 26 | .filterDate({ 27 | start: ee.Date.fromYMD(yrStart, 1, 1), 28 | end: ee.Date.fromYMD(yrEnd, 12, 1) 29 | }); 30 | var waterstorage_mean = waterstorage.select(varBand).mean(); 31 | print(waterstorage_mean); 32 | 33 | var y = 2003; 34 | var date = ee.Date.fromYMD(y, 1, 1); 35 | 36 | var waterstorageIC = ee.Image(ee.ImageCollection( 37 | 'NASA/GLDAS/V021/NOAH/G025/T3H') 38 | .select(varBand) 39 | .filter(ee.Filter.calendarRange(y, y, 'year')) 40 | .mean()); 41 | print(waterstorageIC); 42 | 43 | var waterstorage_out = ee.Image(waterstorageIC.subtract( 44 | waterstorage_mean) 45 | .set('year', y) 46 | .set('system:time_start', date)); 47 | print(waterstorage_out); 48 | 49 | // Change the assetId & description below to reflect the variable being exported. 50 | // These should be changed to reflect SM, SWE, Can etc. 51 | 52 | Export.image.toAsset({ 53 | image: waterstorage_out, 54 | description: 'swe2003', 55 | assetId: 'swe2003', 56 | region: basin, 57 | scale: 10000, 58 | maxPixels: 1e13 59 | }); -------------------------------------------------------------------------------- /Part A - Applications/A2 - Aquatic and Hydrological Applications/A2.2 Benthic Habitats/A22a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A2.2 Benthic Habitats 3 | // Checkpoint: A22a 4 | // Authors: Dimitris Poursanidis, Aurélie C. Shapiro, Spyros Christofilakos 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Section 1 8 | // Import and display satellite image. 9 | var planet = ee.Image('projects/gee-book/assets/A2-2/20200505_N2000') 10 | .divide(10000); 11 | 12 | Map.centerObject(planet, 12); 13 | var visParams = { 14 | bands: ['b3', 'b2', 'b1'], 15 | min: 0.17, 16 | max: 0.68, 17 | gamma: 0.8 18 | }; 19 | Map.addLayer({ 20 | eeObject: planet, 21 | visParams: visParams, 22 | name: 'planet initial', 23 | shown: true 24 | }); 25 | 26 | // ------------------------------------------------------------------------------ 27 | // CHECKPOINT 28 | // ------------------------------------------------------------------------------ -------------------------------------------------------------------------------- /Part A - Applications/A2 - Aquatic and Hydrological Applications/A2.2 Benthic Habitats/A22b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A2.2 Benthic Habitats 3 | // Checkpoint: A22b 4 | // Authors: Dimitris Poursanidis, Aurélie C. Shapiro, Spyros Christofilakos 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Section 1 8 | // Import and display satellite image. 9 | var planet = ee.Image('projects/gee-book/assets/A2-2/20200505_N2000') 10 | .divide(10000); 11 | 12 | Map.centerObject(planet, 12); 13 | var visParams = { 14 | bands: ['b3', 'b2', 'b1'], 15 | min: 0.17, 16 | max: 0.68, 17 | gamma: 0.8 18 | }; 19 | Map.addLayer({ 20 | eeObject: planet, 21 | visParams: visParams, 22 | name: 'planet initial', 23 | shown: true 24 | }); 25 | 26 | // ------------------------------------------------------------------------------ 27 | // CHECKPOINT 28 | // ------------------------------------------------------------------------------ -------------------------------------------------------------------------------- /Part A - Applications/A2 - Aquatic and Hydrological Applications/A2.4 River morphology/A24a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A2.4 River Morphology 3 | // Checkpoint: A24a 4 | // Authors: Xiao Yang, Theodore Langhorst, Tamlin M. Pavelsky 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | // THIS SCRIPT IS DESIGNED AS A TUTORIAL TO SHOWCASE USING GOOGLE EARTH ENGINE TO ANALYSE 7 | // RIVER PLANVIEW GEOMETRIES AND MORPHOLOGICAL DYNAMICS. THE ANALYSIS IS BUILT ON EXISTING 8 | // MONTHLY WATER CLASSIFICATIONS DATASETS AVAILABLE IN GOOGLE EARTH ENGINE. BY SHOWING 9 | // PREPROCESSING STEPS LIKE HOW TO IDENTIFY RIVERS FROM OTHER TYPES OF WATER BODIES, AND HOW 10 | // TO USE MULTI TEMPORAL WATER LAYERS TO EXTRACT DYNAMICAL CHANGES IN RIVER MORPHOLOGY, IT PROVIDES 11 | // A GUIDE TO EXTRACT INFORMATIONS ON RIVERS USING GOOGLE EARTH ENGINE. 12 | 13 | // ========================================================== 14 | 15 | var getUTMProj = function(lon, lat) { 16 | // given longitude and latitude (in degree decimals) return EPSG string for the 17 | // corresponding UTM projection 18 | // see https://apollomapping.com/blog/gtm-finding-a-utm-zone-number-easily and 19 | // https://sis.apache.org/faq.html 20 | var utmCode = ee.Number(lon).add(180).divide(6).ceil().int(); 21 | var output = ee.Algorithms.If(ee.Number(lat).gte(0), 22 | ee.String('EPSG:326').cat(utmCode.format('%02d')), 23 | ee.String('EPSG:327').cat(utmCode.format('%02d'))); 24 | return (output); 25 | }; 26 | 27 | var coords = aoi.centroid(30).coordinates(); 28 | var lon = coords.get(0); 29 | var lat = coords.get(1); 30 | var crs = getUTMProj(lon, lat); 31 | var scale = ee.Number(30); 32 | 33 | var rpj = function(image) { 34 | return image.reproject({ 35 | crs: crs, 36 | scale: scale 37 | }); 38 | }; 39 | 40 | // ------------------------------------------------------------------------------ 41 | // CHECKPOINT 42 | // ------------------------------------------------------------------------------ -------------------------------------------------------------------------------- /Part A - Applications/A2 - Aquatic and Hydrological Applications/A2.4 River morphology/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | 30 | # Part A2: Aquatic and Hydrological Applications 31 | 32 | Earth Engine’s global scope and long time series allow analysts to understand the water cycle in new and unique ways. These include surface water in the form of floods and river characteristics, long-term issues of water balance, and the detection of subsurface ground water. 33 | 34 | # Chapter A2.4 River Morphology 35 | ## Authors 36 | Xiao Yang, Theodore Langhorst, Tamlin M. Pavelsky 37 | 38 | 39 | 40 | ## Overview 41 | The purpose of this chapter is to showcase Earth Engine’s application in fluvial hydrology and geomorphology. Specifically, we show examples demonstrating how to use Earth Engine to extract a river’s centerline and width, and how to calculate the bank erosion rate. At the end of this chapter, you will be able to distinguish rivers from other water bodies, perform basic morphological analyses, and detect changes in river form over time. 42 | 43 | 44 | ## Learning Outcomes 45 | - Working with Landsat surface water products. 46 | - Calculating river centerline location and width. 47 | - Quantifying river bank erosion. 48 | 49 | ## Link for details: 50 | https://google-earth-engine.com/Aquatic-and-Hydrological-Applications/River-morphology/ 51 | 52 | 53 | 54 | # Invitation for collaborators: 55 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 56 | 57 | https://google-earth-engine.com/contact/ 58 | -------------------------------------------------------------------------------- /Part A - Applications/A2 - Aquatic and Hydrological Applications/A2.6 Defining Seasonality First Date of No Snow/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | 30 | # Part A2: Aquatic and Hydrological Applications 31 | 32 | Earth Engine’s global scope and long time series allow analysts to understand the water cycle in new and unique ways. These include surface water in the form of floods and river characteristics, long-term issues of water balance, and the detection of subsurface ground water. 33 | 34 | # Chapter A2.6: Defining Seasonality: First Date of No Snow 35 | 36 | ## Authors 37 | Amanda Armstrong, Morgan Tassone, Justin Braaten 38 | 39 | 40 | 41 | ## Overview 42 | The purpose of this chapter is to demonstrate how to produce annual maps representing the first day within a year on which a given pixel reaches 0% snow cover. It also provides suggestions for summarizing and visualizing the results over time and space. 43 | 44 | 45 | ## Learning Outcomes 46 | - Generating and using a date band in image compositing. 47 | - Applying temporal filtering to an ImageCollection. 48 | - Identifying patterns of seasonal snowmelt. 49 | 50 | ## Link for details: 51 | https://google-earth-engine.com/Aquatic-and-Hydrological-Applications/Defining-Seasonality-First-Date-of-No-Snow/ 52 | 53 | 54 | 55 | # Invitation for collaborators: 56 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 57 | 58 | https://google-earth-engine.com/contact/ 59 | -------------------------------------------------------------------------------- /Part A - Applications/A2 - Aquatic and Hydrological Applications/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | 30 | # Part A2: Aquatic and Hydrological Applications 31 | 32 | Earth Engine’s global scope and long time series allow analysts to understand the water cycle in new and unique ways. These include surface water in the form of floods and river characteristics, long-term issues of water balance, and the detection of subsurface ground water. 33 | 34 | https://google-earth-engine.com/Aquatic-and-Hydrological-Applications/Groundwater-monitoring-with-GRACE/ 35 | 36 | # Invitation for collaborators: 37 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 38 | 39 | https://google-earth-engine.com/contact/ 40 | -------------------------------------------------------------------------------- /Part A - Applications/A3 - Terrestial Applications/A3.10 Conservation II - Assessing Agricultural Intensification Near Protected Areas/A310a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: Chapter A3.10 Conservation II - Assessing Agricultural 3 | // Intensification Near Protected Areas 4 | // Checkpoint: A310a 5 | // Authors: Pradeep Koulgi, MD Madhusudan 6 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 | 8 | // 1. Parameters to function calls 9 | 10 | // 1.1. Annual dry season max NDVI calculation 11 | var modis_veg = ee.ImageCollection('MODIS/006/MOD13Q1'); 12 | var ndviBandName = 'NDVI'; 13 | var ndviValuesScaling = 0.0001; 14 | var modisVegScale = 250; // meters 15 | var maxNDVIBandname = 'max_dryseason_ndvi'; 16 | var yearTimestampBandname = 'year'; 17 | var years = ee.List.sequence(2000, 2021, 1); 18 | var drySeasonStart_doy = 1; 19 | var drySeasonEnd_doy = 90; 20 | 21 | // 1.2. Boundaries of Protected Areas of interest 22 | var paBoundaries = ee.FeatureCollection( 23 | 'projects/gee-book/assets/A3-10/IndiaMainlandPAs'); 24 | var boundaryBufferWidth = 5000; // meters 25 | var bufferingMaxError = 30; // meters 26 | // Choose PAs in only the western states 27 | var western_states = [ 28 | 'Rajasthan', 'Gujarat', 'Madhya Pradesh', 29 | 'Maharashtra', 'Goa', 'Karnataka', 'Kerala' 30 | ]; 31 | var western_pas = paBoundaries 32 | .filter(ee.Filter.inList('STATE', western_states)); 33 | 34 | // 1.3. Regression analysis 35 | var regressionReducer = ee.Reducer.sensSlope(); 36 | var regressionX = yearTimestampBandname; 37 | var regressionY = maxNDVIBandname; 38 | 39 | // 1.4. Surface water layer to mask water pixels from assessment 40 | // Selects pixels where water has ever been detected between 1984 and 2021 41 | var surfaceWaterExtent = ee.Image('JRC/GSW1_3/GlobalSurfaceWater') 42 | .select('max_extent'); 43 | 44 | // 1.5. Average annual precipitation layer 45 | var rainfall = ee.Image('WORLDCLIM/V1/BIO').select('bio12'); 46 | 47 | // 1.6. Visualization parameters 48 | var regressionResultVisParams = { 49 | min: -3, 50 | max: 3, 51 | palette: ['ff8202', 'ffffff', '356e02'] 52 | }; 53 | var regressionSummaryChartingOptions = { 54 | title: 'Yearly change in dry-season vegetation greenness ' + 55 | 'in PA buffers in relation to average annual rainfall', 56 | hAxis: { 57 | title: 'Annual Precipitation' 58 | }, 59 | vAxis: { 60 | title: 'Median % yearly change in vegetation greenness ' + 61 | 'in 5 km buffer' 62 | }, 63 | series: { 64 | 0: { 65 | visibleInLegend: false 66 | } 67 | }, 68 | }; 69 | 70 | // ----------------------------------------------------------------------- 71 | // CHECKPOINT 72 | // ----------------------------------------------------------------------- 73 | -------------------------------------------------------------------------------- /Part A - Applications/A3 - Terrestial Applications/A3.2 Mangroves/A32a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A3.2 Mangroves 3 | // Checkpoint: A32a 4 | // Author: Aurélie Shapiro 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Create an ee.Geometry. 8 | var aoi = ee.Geometry.Polygon([ 9 | [ 10 | [88.3, 22.61], 11 | [90, 22.61], 12 | [90, 21.47], 13 | [88.3, 21.47] 14 | ] 15 | ]); 16 | 17 | // Locate a coordinate in the aoi with land and water. 18 | var point = ee.Geometry.Point([89.2595, 21.7317]); 19 | 20 | // Position the map. 21 | Map.centerObject(point, 13); 22 | Map.addLayer(aoi, {}, 'AOI'); 23 | 24 | // Sentinel-1 wet season data. 25 | var wetS1 = ee.Image( 26 | 'projects/gee-book/assets/A3-2/wet_season_tscan_2020'); 27 | // Sentinel-1 dry season data. 28 | var dryS1 = ee.Image( 29 | 'projects/gee-book/assets/A3-2/dry_season_tscan_2020'); 30 | // Sentinel-2 mosaic. 31 | var S2 = ee.Image('projects/gee-book/assets/A3-2/Sundarbans_S2_2020'); 32 | 33 | //Visualize the input data. 34 | var s1VisParams = { 35 | bands: ['VV_min', 'VH_min', 'VVVH_ratio_min'], 36 | min: -36, 37 | max: 3 38 | }; 39 | var s2VisParams = { 40 | bands: ['swir1', 'nir', 'red'], 41 | min: 82, 42 | max: 3236 43 | }; 44 | 45 | Map.addLayer(dryS1, s1VisParams, 'S1 dry', false); 46 | Map.addLayer(wetS1, s1VisParams, 'S1 wet', false); 47 | Map.addLayer(S2, s2VisParams, 'S2 2020'); 48 | 49 | var NDVI = S2.normalizedDifference(['nir', 'red']).rename(['NDVI']); 50 | 51 | var ratio_swir1_nir = S2.expression( 52 | 'swir1/(nir+0.1)', { 53 | 'swir1': S2.select('swir1'), 54 | 'nir': S2.select('nir') 55 | }) 56 | .rename('ratio_swir1_nir_wet'); 57 | 58 | var data_stack = S2.addBands(NDVI).addBands(ratio_swir1_nir).addBands( 59 | dryS1).addBands(wetS1).addBands(S2); 60 | 61 | print(data_stack); 62 | // ----------------------------------------------------------------------- 63 | // CHECKPOINT 64 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A3 - Terrestial Applications/A3.3 Mangroves II - Change Mapping/A33a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A3.3 Mangroves II - Change Mapping 3 | // Checkpoint: A33a 4 | // Authors: Celio de Sousa, David Lagomasino, and Lola Fatoyinbo 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // STEP 1 - ADD THE MAPS 8 | var areaOfstudy = ee.FeatureCollection( 9 | 'projects/gee-book/assets/A3-3/Border5km'); 10 | var mangrove2000 = ee.Image( 11 | 'projects/gee-book/assets/A3-3/MangroveGuinea2000_v2'); 12 | var mangrove2020 = ee.Image( 13 | 'projects/gee-book/assets/A3-3/MangroveGuinea2020_v2'); 14 | 15 | Map.setCenter(-13.6007, 9.6295, 10); 16 | // Sets the map center to Conakry, Guinea 17 | Map.addLayer(areaOfstudy, {}, 'Area of Study'); 18 | Map.addLayer(mangrove2000, { 19 | palette: '#16a596' 20 | }, 'Mangrove Extent 2000'); 21 | Map.addLayer(mangrove2020, { 22 | palette: '#9ad3bc' 23 | }, 'Mangrove Extent 2020'); 24 | 25 | // STEP 2 - MAP TO MAP CHANGE 26 | 27 | var mang2020 = mangrove2020.unmask(0); 28 | var mang2000 = mangrove2000.unmask(0); 29 | var change = mang2020.subtract(mang2000) 30 | .clip(areaOfstudy); 31 | 32 | var paletteCHANGE = [ 33 | 'red', // Loss/conversion 34 | 'white', // No Change 35 | 'green', // Gain/Expansion 36 | ]; 37 | 38 | Map.addLayer(change, { 39 | min: -1, 40 | max: 1, 41 | palette: paletteCHANGE 42 | }, 'Changes 2000-2020'); 43 | 44 | // Calculate the area of each pixel 45 | var gain = change.eq(1); 46 | var loss = change.eq(-1); 47 | 48 | var gainArea = gain.multiply(ee.Image.pixelArea().divide(1000000)); 49 | var lossArea = loss.multiply(ee.Image.pixelArea().divide(1000000)); 50 | 51 | // Sum all the areas 52 | var statsgain = gainArea.reduceRegion({ 53 | reducer: ee.Reducer.sum(), 54 | scale: 30, 55 | maxPixels: 1e14 56 | }); 57 | 58 | var statsloss = lossArea.reduceRegion({ 59 | reducer: ee.Reducer.sum(), 60 | scale: 30, 61 | maxPixels: 1e14 62 | }); 63 | 64 | print(statsgain.get('classification'), 65 | 'km² of new mangroves in 2020'); 66 | print(statsloss.get('classification'), 67 | 'of mangrove was lost in 2020'); 68 | 69 | Map.addLayer(gain.selfMask(), { 70 | palette: 'green' 71 | }, 'Gains'); 72 | Map.addLayer(loss.selfMask(), { 73 | palette: 'red' 74 | }, 'Loss'); 75 | 76 | // ----------------------------------------------------------------------- 77 | // CHECKPOINT 78 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A3 - Terrestial Applications/A3.4 Forest Degradation and Deforestation/A34c-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A3.4 Forest Degradation and Deforestation 3 | // Checkpoint: A34c 4 | // Author: Carlos Souza Jr., Karis Tenneson, John Dilger, 5 | // Crystal Wespestad, Eric Bullock 6 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 | 8 | var api = require('users/bullocke/coded:CODED/api'); 9 | var utils = require('projects/GLANCE:ccdcUtilities/api'); 10 | 11 | // ------------------------------------------------------------------------ 12 | // CHECKPOINT 13 | // ------------------------------------------------------------------------ -------------------------------------------------------------------------------- /Part A - Applications/A3 - Terrestial Applications/A3.4 Forest Degradation and Deforestation/A34d-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A3.4 Forest Degradation and Deforestation 3 | // Checkpoint: A34d 4 | // Author: Carlos Souza Jr., Karis Tenneson, John Dilger, 5 | // Crystal Wespestad, Eric Bullock 6 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 | 8 | var api = require('users/bullocke/coded:CODED/api'); 9 | var utils = require('projects/GLANCE:ccdcUtilities/api'); 10 | 11 | // ------------------------------------------------------------------------ 12 | // CHECKPOINT 13 | // ------------------------------------------------------------------------ 14 | 15 | // We will use the geometry of the image from the previous section as 16 | // the study area. 17 | var studyArea = ee.Image( 18 | 'LANDSAT/LT05/C02/T1_L2/LT05_226068_19840411') 19 | .geometry(); 20 | 21 | // Get cloud masked (Fmask) Landsat imagery. 22 | var landsat = utils.Inputs.getLandsat() 23 | .filterBounds(studyArea) 24 | .filterDate('1984-01-01', '2021-01-01'); 25 | 26 | // Make a forest mask 27 | var gfwImage = ee.Image('UMD/hansen/global_forest_change_2019_v1_7'); 28 | 29 | // Get areas of forest cover above the threshold 30 | var treeCover = 40; 31 | var forestMask = gfwImage.select('treecover2000') 32 | .gte(treeCover) 33 | .rename('landcover'); 34 | 35 | var samples = ee.FeatureCollection( 36 | 'projects/gee-book/assets/A3-4/sample_with_pred_hansen_2010'); 37 | 38 | var minObservations = 4; 39 | var chiSquareProbability = 0.97; 40 | var training = samples; 41 | var forestValue = 1; 42 | var startYear = 1990; 43 | var endYear = 2020; 44 | var classBands = ['NDFI', 'GV', 'Shade', 'NPV', 'Soil']; 45 | var prepTraining = false; 46 | 47 | //---------------- CODED parameters 48 | var codedParams = { 49 | minObservations: minObservations, 50 | chiSquareProbability: chiSquareProbability, 51 | training: training, 52 | studyArea: studyArea, 53 | forestValue: forestValue, 54 | forestMask: forestMask, 55 | classBands: classBands, 56 | collection: landsat, 57 | startYear: startYear, 58 | endYear: endYear, 59 | prepTraining: prepTraining 60 | }; 61 | 62 | // -------------- Run CODED 63 | var results = api.ChangeDetection.coded(codedParams); 64 | print(results); 65 | 66 | // ------------------------------------------------------------------------ 67 | // CHECKPOINT 68 | // ------------------------------------------------------------------------ -------------------------------------------------------------------------------- /Part A - Applications/A3 - Terrestial Applications/A3.4 Forest Degradation and Deforestation/modules/palletes.js: -------------------------------------------------------------------------------- 1 | var ndfiColors = 2 | 'FFFFFF,FFFCFF,FFF9FF,FFF7FF,FFF4FF,FFF2FF,FFEFFF,FFECFF,FFEAFF,FFE7FF,'+ 3 | 'FFE5FF,FFE2FF,FFE0FF,FFDDFF,FFDAFF,FFD8FF,FFD5FF,FFD3FF,FFD0FF,FFCEFF,'+ 4 | 'FFCBFF,FFC8FF,FFC6FF,FFC3FF,FFC1FF,FFBEFF,FFBCFF,FFB9FF,FFB6FF,FFB4FF,'+ 5 | 'FFB1FF,FFAFFF,FFACFF,FFAAFF,FFA7FF,FFA4FF,FFA2FF,FF9FFF,FF9DFF,FF9AFF,'+ 6 | 'FF97FF,FF95FF,FF92FF,FF90FF,FF8DFF,FF8BFF,FF88FF,FF85FF,FF83FF,FF80FF,'+ 7 | 'FF7EFF,FF7BFF,FF79FF,FF76FF,FF73FF,FF71FF,FF6EFF,FF6CFF,FF69FF,FF67FF,'+ 8 | 'FF64FF,FF61FF,FF5FFF,FF5CFF,FF5AFF,FF57FF,FF55FF,FF52FF,FF4FFF,FF4DFF,'+ 9 | 'FF4AFF,FF48FF,FF45FF,FF42FF,FF40FF,FF3DFF,FF3BFF,FF38FF,FF36FF,FF33FF,'+ 10 | 'FF30FF,FF2EFF,FF2BFF,FF29FF,FF26FF,FF24FF,FF21FF,FF1EFF,FF1CFF,FF19FF,'+ 11 | 'FF17FF,FF14FF,FF12FF,FF0FFF,FF0CFF,FF0AFF,FF07FF,FF05FF,FF02FF,FF00FF,'+ 12 | 'FF00FF,FF0AF4,FF15E9,FF1FDF,FF2AD4,FF35C9,FF3FBF,FF4AB4,FF55AA,FF5F9F,'+ 13 | 'FF6A94,FF748A,FF7F7F,FF8A74,FF946A,FF9F5F,FFAA55,FFB44A,FFBF3F,FFC935,'+ 14 | 'FFD42A,FFDF1F,FFE915,FFF40A,FFFF00,FFFF00,FFFB00,FFF700,FFF300,FFF000,'+ 15 | 'FFEC00,FFE800,FFE400,FFE100,FFDD00,FFD900,FFD500,FFD200,FFCE00,FFCA00,'+ 16 | 'FFC600,FFC300,FFBF00,FFBB00,FFB700,FFB400,FFB000,FFAC00,FFA800,FFA500,'+ 17 | 'FFA500,F7A400,F0A300,E8A200,E1A200,D9A100,D2A000,CA9F00,C39F00,BB9E00,'+ 18 | 'B49D00,AC9C00,A59C00,9D9B00,969A00,8E9900,879900,7F9800,789700,709700,'+ 19 | '699600,619500,5A9400,529400,4B9300,439200,349100,2D9000,258F00,1E8E00,'+ 20 | '168E00,0F8D00,078C00,008C00,008C00,008700,008300,007F00,007A00,007600,'+ 21 | '007200,006E00,006900,006500,006100,005C00,005800,005400,005000,004C00'; 22 | exports = { 23 | ndfiColors : ndfiColors 24 | }; -------------------------------------------------------------------------------- /Part A - Applications/A3 - Terrestial Applications/A3.5 Deforestation Viewed from Multiple Sensors/A35a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A3.5 Deforestation Viewed from Multiple Sensors 3 | // Checkpoint: A35a 4 | // Author: Xiaojing Tang 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Fusion Near Real-time (GUI) 8 | // Near real-time monitoring of forest disturbance by fusion of 9 | // multi-sensor data. @author Xiaojing Tang (xjtang@bu.edu). 10 | 11 | // To run this interface, please access it by entering the link 12 | // below in a separate browser window. 13 | 14 | // https://gee-book.earthengine.app/view/fnrt 15 | -------------------------------------------------------------------------------- /Part A - Applications/A3 - Terrestial Applications/A3.5 Deforestation Viewed from Multiple Sensors/A35b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A3.5 Deforestation Viewed from Multiple Sensors 3 | // Checkpoint: A35b 4 | // Author: Xiaojing Tang 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | var testArea = ee.Geometry.Polygon( 8 | [ 9 | [ 10 | [-66.73156878460787, -8.662236005089952], 11 | [-66.73156878460787, -8.916025640576244], 12 | [-66.44867083538912, -8.916025640576244], 13 | [-66.44867083538912, -8.662236005089952] 14 | ] 15 | ]); 16 | 17 | Map.centerObject(testArea); 18 | 19 | // Start and end of the training and monitoring period. 20 | var trainPeriod = ee.Dictionary({ 21 | 'start': '2017-01-01', 22 | 'end': '2020-01-01' 23 | }); 24 | var monitorPeriod = ee.Dictionary({ 25 | 'start': '2020-01-01', 26 | 'end': '2021-01-01' 27 | }); 28 | 29 | // Near-real-time monitoring parameters. 30 | var nrtParam = { 31 | z: 2, 32 | m: 5, 33 | n: 4 34 | }; 35 | 36 | // Sensor specific parameters. 37 | var lstParam = { 38 | band: 'NDFI', 39 | minRMSE: 0.05, 40 | strikeOnly: false 41 | }; 42 | var s2Param = { 43 | band: 'NDFI', 44 | minRMSE: 0.05, 45 | strikeOnly: false 46 | }; 47 | var s1Param = { 48 | band: 'VV', 49 | minRMSE: 0.01, 50 | strikeOnly: true 51 | }; 52 | 53 | // ------------------------------------------------------------------------ 54 | // CHECKPOINT 55 | // ------------------------------------------------------------------------ -------------------------------------------------------------------------------- /Part A - Applications/A3 - Terrestial Applications/A3.6 Working With GPS & Weather Data/A36a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A3.6 Working With GPS and Weather Data 3 | // Checkpoint: A36a 4 | // Authors: Peder Engelstad, Daniel Carver, Nicholas E. Young 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Import the data and add it to the map and print. 8 | var cougarF53 = ee.FeatureCollection( 9 | 'projects/gee-book/assets/A3-6/cougarF53'); 10 | 11 | Map.centerObject(cougarF53, 10); 12 | 13 | Map.addLayer(cougarF53, {}, 'cougar presence data'); 14 | 15 | print(cougarF53, 'cougar data'); 16 | 17 | // Call in image collection and filter. 18 | var Daymet = ee.ImageCollection('NASA/ORNL/DAYMET_V4') 19 | .filterDate('2014-02-11', '2014-11-02') 20 | .filterBounds(geometry) 21 | .map(function(image) { 22 | return image.clip(geometry); 23 | }); 24 | 25 | print(Daymet, 'Daymet'); 26 | 27 | 28 | // Convert to a multiband image. 29 | var DaymetImage = Daymet.toBands(); 30 | 31 | print(DaymetImage, 'DaymetImage'); 32 | 33 | // Call the sample regions function. 34 | var samples = DaymetImage.sampleRegions({ 35 | collection: cougarF53, 36 | properties: ['id'], 37 | scale: 1000 38 | }); 39 | 40 | print(samples, 'samples'); 41 | 42 | // ----------------------------------------------------------------------- 43 | // CHECKPOINT 44 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A3 - Terrestial Applications/A3.6 Working With GPS & Weather Data/A36b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A3.6 Working With GPS and Weather Data 3 | // Checkpoint: A36b 4 | // Authors: Peder Engelstad, Daniel Carver, Nicholas E. Young 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Import the data and add it to the map and print. 8 | var cougarF53 = ee.FeatureCollection( 9 | 'projects/gee-book/assets/A3-6/cougarF53'); 10 | 11 | Map.centerObject(cougarF53, 10); 12 | 13 | Map.addLayer(cougarF53, {}, 'cougar presence data'); 14 | 15 | print(cougarF53, 'cougar data'); 16 | 17 | // Call in image collection and filter. 18 | var Daymet = ee.ImageCollection('NASA/ORNL/DAYMET_V4') 19 | .filterDate('2014-02-11', '2014-11-02') 20 | .filterBounds(geometry) 21 | .map(function(image) { 22 | return image.clip(geometry); 23 | }); 24 | 25 | print(Daymet, 'Daymet'); 26 | 27 | // Convert to a multiband image. 28 | var DaymetImage = Daymet.toBands(); 29 | 30 | print(DaymetImage, 'DaymetImage'); 31 | 32 | // Call the sample regions function. 33 | var samples = DaymetImage.sampleRegions({ 34 | collection: cougarF53, 35 | properties: ['id'], 36 | scale: 1000 37 | }); 38 | 39 | print(samples, 'samples'); 40 | 41 | // ----------------------------------------------------------------------- 42 | // CHECKPOINT 43 | // ----------------------------------------------------------------------- 44 | 45 | // Export value added data to your Google Drive. 46 | Export.table.toDrive({ 47 | collection: samples, 48 | description: 'cougarDaymetToDriveExample', 49 | fileFormat: 'csv' 50 | }); 51 | 52 | // Apply a median reducer to the dataset. 53 | var daymet1 = Daymet 54 | .median() 55 | .clip(geometry); 56 | 57 | print(daymet1); 58 | 59 | // Export the image to drive. 60 | Export.image.toDrive({ 61 | image: daymet1, 62 | description: 'MedianValueForStudyArea', 63 | scale: 1000, 64 | region: geometry, 65 | maxPixels: 1e9 66 | }); 67 | 68 | // ----------------------------------------------------------------------- 69 | // CHECKPOINT 70 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A3 - Terrestial Applications/A3.8 Detecting Land Cover Change in Rangelands/A38a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A3.8 Detecting Land Cover Change in Rangelands 3 | // Checkpoint: A38a 4 | // Authors: Ginger Allington, Natalie Kreitzer 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Load the shapefile asset for the AOI as a Feature Collection 8 | var aoi = ee.FeatureCollection( 9 | 'projects/gee-book/assets/A3-8/GEE_Ch_AOI'); 10 | Map.centerObject(aoi, 11); 11 | Map.addLayer(aoi, {}, 'Subset of Naiman Banner'); 12 | 13 | // Filter the MODIS Collection 14 | var MODIS_LC = ee.ImageCollection('MODIS/006/MCD12Q1').select( 15 | 'LC_Type1'); 16 | 17 | // Function to clip an image from the collection and set the year 18 | var clipCol = function(img) { 19 | var date = ee.String(img.get('system:index')); 20 | date = date.slice(0, 4); 21 | return img.select('LC_Type1').clip(aoi) // .clip(aoi) 22 | .set('year', date); 23 | }; 24 | 25 | // Generate images for diff years you want to compare 26 | var modis01 = MODIS_LC.filterDate('2001-01-01', '2002-01-01').map( 27 | clipCol); 28 | var modis09 = MODIS_LC.filterDate('2009-01-01', '2010-01-01').map( 29 | clipCol); 30 | var modis16 = MODIS_LC.filterDate('2016-01-01', '2017-01-01').map( 31 | clipCol); 32 | // Create an Image for each of the years 33 | var modis01 = modis01.first(); 34 | var modis09 = modis09.first(); 35 | var modis16 = modis16.first(); 36 | 37 | Map.addLayer(modis01.randomVisualizer(), {}, 'modis 2001', false); 38 | Map.addLayer(modis09.randomVisualizer(), {}, 'modis 2009', false); 39 | Map.addLayer(modis16.randomVisualizer(), {}, 'modis 2016', false); 40 | 41 | // Add and clip the WorldCover data 42 | var wCov = ee.ImageCollection('ESA/WorldCover/v100').first(); 43 | var landcover20 = wCov.clip(aoi); 44 | Map.addLayer(landcover20, {}, 'Landcover 2020'); 45 | 46 | // ----------------------------------------------------------------------- 47 | // CHECKPOINT 48 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part A - Applications/A3 - Terrestial Applications/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | # Part A3: Terrestrial Applications 30 | 31 | Earth’s terrestrial surface is analyzed regularly by satellites, in search of both change and stability. These are of great interest to a wide cross-section of Earth Engine users, and projects across large areas illustrate both the challenges and opportunities for life on Earth. Chapters in this Part illustrate the use of Earth Engine for disturbance, understanding long-term changes of rangelands, and creating optimum study sites. 32 | 33 | https://google-earth-engine.com/Terrestrial-Applications-part-1/Active-fire-monitoring/ 34 | 35 | # Invitation for collaborators: 36 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 37 | 38 | https://google-earth-engine.com/contact/ 39 | -------------------------------------------------------------------------------- /Part A - Applications/A3 - Terrestial Applications/​A3.1 Active fire monitoring/A31b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A3.1 Active fire monitoring 3 | // Checkpoint: A31b 4 | // Authors: Morgan A. Crowley* and Tianjia Liu* (*shared first-authorship) 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Bobcat Fire in the Earth Engine app FIRMS Active Fires ( 8 | 9 | // https://globalfires.earthengine.app/view/firms 10 | 11 | // ). 12 | 13 | -------------------------------------------------------------------------------- /Part A - Applications/A3 - Terrestial Applications/​A3.1 Active fire monitoring/A31c-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A3.1 Active fire monitoring 3 | // Checkpoint: A31c 4 | // Authors: Morgan A. Crowley* and Tianjia Liu* (*shared first-authorship) 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Your app should now look like this (click the Submit button): 8 | 9 | // https://bit.ly/FIRMS_Bobcat. 10 | -------------------------------------------------------------------------------- /Part A - Applications/A3 - Terrestial Applications/​A3.1 Active fire monitoring/A31d-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: A3.1 Active fire monitoring 3 | // Checkpoint: A31d 4 | // Authors: Morgan A. Crowley* and Tianjia Liu* (*shared first-authorship) 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | 8 | // the Earth Engine app U.S. Fire Dashboard ( 9 | 10 | // https://globalfires.earthengine.app/view/us-fire-dashboard 11 | 12 | // ). -------------------------------------------------------------------------------- /Part A - Applications/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | 30 | # Invitation for collaborators: 31 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 32 | 33 | https://google-earth-engine.com/contact/ 34 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F1 - Programming and Remote Sensing Basics/F1.1 Exploring Images/F11a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F1.1 Exploring images 3 | // Checkpoint: F11a 4 | // Author: Jeff Howarth 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Load an image from its Earth Engine ID. 8 | var first_image = ee.Image( 9 | 'LANDSAT/LT05/C02/T1_L2/LT05_118038_20000606'); 10 | 11 | // Inspect the image object in the Console. 12 | print(first_image); 13 | 14 | // Display band 1 of the image as the first map layer. 15 | Map.addLayer( 16 | first_image, // dataset to display 17 | { 18 | bands: ['SR_B1'], // band to display 19 | min: 8000, // display range 20 | max: 17000 21 | }, 22 | 'Layer 1' // name to show in Layer Manager 23 | ); 24 | 25 | // Display band 2 as the second map layer. 26 | Map.addLayer( 27 | first_image, 28 | { 29 | bands: ['SR_B2'], 30 | min: 8000, 31 | max: 17000 32 | }, 33 | 'Layer 2', 34 | 0, // shown 35 | 1 // opacity 36 | ); 37 | 38 | // Display band 3 as the third map layer. 39 | Map.addLayer( 40 | first_image, 41 | { 42 | bands: ['SR_B3'], 43 | min: 8000, 44 | max: 17000 45 | }, 46 | 'Layer 3', 47 | 1, // shown 48 | 0 // opacity 49 | ); 50 | 51 | // ----------------------------------------------------------------------- 52 | // CHECKPOINT 53 | // ----------------------------------------------------------------------- 54 | 55 | 56 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F1 - Programming and Remote Sensing Basics/F1.1 Exploring Images/F11b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F1.1 Exploring images 3 | // Checkpoint: F11b 4 | // Author: Jeff Howarth 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Load an image from its Earth Engine ID. 8 | var first_image = ee.Image( 9 | 'LANDSAT/LT05/C02/T1_L2/LT05_118038_20000606'); 10 | 11 | // Inspect the image object in the Console. 12 | print(first_image); 13 | 14 | // Display band 1 of the image as the first map layer. 15 | Map.addLayer( 16 | first_image, // dataset to display 17 | { 18 | bands: ['SR_B1'], // band to display 19 | min: 8000, // display range 20 | max: 17000 21 | }, 22 | 'Layer 1' // name to show in Layer Manager 23 | ); 24 | 25 | // Display band 2 as the second map layer. 26 | Map.addLayer( 27 | first_image, 28 | { 29 | bands: ['SR_B2'], 30 | min: 8000, 31 | max: 17000 32 | }, 33 | 'Layer 2', 34 | 0, // shown 35 | 1 // opacity 36 | ); 37 | 38 | // Display band 3 as the third map layer. 39 | Map.addLayer( 40 | first_image, 41 | { 42 | bands: ['SR_B3'], 43 | min: 8000, 44 | max: 17000 45 | }, 46 | 'Layer 3', 47 | 1, // shown 48 | 0 // opacity 49 | ); 50 | 51 | // ----------------------------------------------------------------------- 52 | // CHECKPOINT 53 | // ----------------------------------------------------------------------- 54 | 55 | // Add a natural color layer by using the first three sensor bands for RGB. 56 | Map.addLayer( 57 | first_image, 58 | { 59 | bands: ['SR_B3', 'SR_B2', 'SR_B1'], 60 | min: 8000, 61 | max: 17000 62 | }, 63 | 'Natural Color'); 64 | 65 | // Add a NIR false-color layer using NIR, red, green sensor bands for RGB. 66 | Map.addLayer( 67 | first_image, 68 | { 69 | bands: ['SR_B4', 'SR_B3', 'SR_B2'], 70 | min: 8000, 71 | max: 17000 72 | }, 73 | 'False Color'); 74 | 75 | // Add a SWIR false-color layer using SWIR, NIR, green sensor bands for RGB. 76 | Map.addLayer( 77 | first_image, 78 | { 79 | bands: ['SR_B5', 'SR_B4', 'SR_B2'], 80 | min: 8000, 81 | max: 17000 82 | }, 83 | 'Short wave false color'); 84 | 85 | // ----------------------------------------------------------------------- 86 | // CHECKPOINT 87 | // ----------------------------------------------------------------------- 88 | 89 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F1 - Programming and Remote Sensing Basics/F1.1 Exploring Images/F11s1-example-4.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F1.1 Exploring images 3 | // Section: Practice problem (Assignment 4) 4 | // Author: Jeff Howarth 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Load the practice image from the Earth Engine ID. 8 | var practice_image = ee.Image( 9 | 'LANDSAT/LT05/C02/T1_L2/LT05_022039_20050907'); 10 | 11 | // Print image metadata to the Console. 12 | print(practice_image); 13 | 14 | // Center the Map on the image. 15 | Map.centerObject(practice_image, 9); 16 | 17 | // Add a natural color composite to the Map. 18 | Map.addLayer( 19 | practice_image, 20 | { 21 | bands: ['SR_B3', 'SR_B2', 'SR_B1'], 22 | min: 8000, 23 | max: 17000 24 | }, 25 | 'Natural color' 26 | ); 27 | 28 | // Add an NIR false color composite to the Map. 29 | Map.addLayer( 30 | practice_image, 31 | { 32 | bands: ['SR_B4', 'SR_B3', 'SR_B2'], 33 | min: 8000, 34 | max: 17000 35 | }, 36 | 'NIR false color' 37 | ); 38 | 39 | // Add a SWIR false color composite to the Map. 40 | Map.addLayer( 41 | practice_image, 42 | { 43 | bands: ['SR_B5', 'SR_B4', 'SR_B2'], 44 | min: 8000, 45 | max: 17000 46 | }, 47 | 'SWIR false color' 48 | ); 49 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F1 - Programming and Remote Sensing Basics/F1.1 Exploring Images/F11s2-example-5.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F1.1 Exploring images 3 | // Section: Practice problem (Assignment 5) 4 | // Author: Jeff Howarth 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | var image = ee.Image('LANDSAT/LT05/C02/T1_L2/LT05_118038_20000606'); 8 | 9 | Map.addLayer( 10 | image, 11 | { 12 | bands: ['SR_B1'], 13 | min: 8000, 14 | max: 17000 15 | }, 16 | 'Layer 1' 17 | ); 18 | 19 | Map.addLayer( 20 | image.select('SR_B1'), 21 | { 22 | min: 8000, 23 | max: 17000 24 | }, 25 | 'Layer 2' 26 | ); 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F1 - Programming and Remote Sensing Basics/F1.2 Survey of Raster Datasets/F12a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F1.2 Survey of Raster Datasets 3 | // Checkpoint: F12a 4 | // Authors: Andréa, Karen, Nick Clinton, David Saah 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | ///// 8 | // View an Image Collection 9 | ///// 10 | 11 | // Import the Landsat 8 Raw Collection. 12 | var landsat8 = ee.ImageCollection('LANDSAT/LC08/C02/T1'); 13 | 14 | // Print the size of the Landsat 8 dataset. 15 | print('The size of the Landsat 8 image collection is:', landsat8 16 | .size()); 17 | 18 | // Try to print the image collection. 19 | // WARNING! Running the print code immediately below produces an error because 20 | // the Console can not print more than 5000 elements. 21 | print(landsat8); 22 | 23 | // Add the Landsat 8 dataset to the Map as a mosaic. The collection is 24 | // already chronologically sorted, so the most recent pixel is displayed. 25 | Map.addLayer(landsat8, 26 | { 27 | bands: ['B4', 'B3', 'B2'], 28 | min: 5000, 29 | max: 15000 30 | }, 31 | 'Landsat 8 Image Collection'); 32 | 33 | // ----------------------------------------------------------------------- 34 | // CHECKPOINT 35 | // ----------------------------------------------------------------------- 36 | 37 | 38 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F1 - Programming and Remote Sensing Basics/F1.2 Survey of Raster Datasets/F12c-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F1.2 Survey of Raster Datasets 3 | // Checkpoint: F12c 4 | // Authors: Andréa, Karen, Nick Clinton, David Saah 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | ///// 8 | // Collections of single images - Landsat 8 Surface Reflectance 9 | ///// 10 | 11 | // Create and Earth Engine Point object over San Francisco. 12 | var pointSF = ee.Geometry.Point([-122.44, 37.76]); 13 | 14 | // Import the Landsat 8 Surface Reflectance collection. 15 | var landsat8SR = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2'); 16 | 17 | // Filter the collection and select the first image. 18 | var landsat8SRimage = landsat8SR.filterDate('2014-03-18', 19 | '2014-03-19') 20 | .filterBounds(pointSF) 21 | .first(); 22 | 23 | print('Landsat 8 Surface Reflectance image', landsat8SRimage); 24 | 25 | // Center map to the first image. 26 | Map.centerObject(landsat8SRimage, 8); 27 | 28 | // Add first image to the map. 29 | Map.addLayer(landsat8SRimage, 30 | { 31 | bands: ['SR_B4', 'SR_B3', 'SR_B2'], 32 | min: 7000, 33 | max: 13000 34 | }, 35 | 'Landsat 8 SR'); 36 | 37 | // ----------------------------------------------------------------------- 38 | // CHECKPOINT 39 | // ----------------------------------------------------------------------- 40 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F1 - Programming and Remote Sensing Basics/F1.2 Survey of Raster Datasets/F12d-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F1.2 Survey of Raster Datasets 3 | // Checkpoint: F12d 4 | // Authors: Andréa, Karen, Nick Clinton, David Saah 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | ///// 8 | // Collections of single images - Landsat 8 Surface Reflectance 9 | ///// 10 | 11 | // Create and Earth Engine Point object over San Francisco. 12 | var pointSF = ee.Geometry.Point([-122.44, 37.76]); 13 | 14 | // Import the Landsat 8 Surface Reflectance collection. 15 | var landsat8SR = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2'); 16 | 17 | // Filter the collection and select the first image. 18 | var landsat8SRimage = landsat8SR.filterDate('2014-03-18', 19 | '2014-03-19') 20 | .filterBounds(pointSF) 21 | .first(); 22 | 23 | 24 | print('Landsat 8 Surface Reflectance image', landsat8SRimage); 25 | 26 | // Center map to the first image. 27 | Map.centerObject(landsat8SRimage, 8); 28 | 29 | // Add first image to the map. 30 | Map.addLayer(landsat8SRimage, 31 | { 32 | bands: ['SR_B4', 'SR_B3', 'SR_B2'], 33 | min: 7000, 34 | max: 13000 35 | }, 36 | 'Landsat 8 SR'); 37 | 38 | // ----------------------------------------------------------------------- 39 | // CHECKPOINT 40 | // ----------------------------------------------------------------------- 41 | 42 | ///// 43 | // Pre-made composites 44 | ///// 45 | 46 | // Import a MODIS dataset of daily BRDF-corrected reflectance. 47 | var modisDaily = ee.ImageCollection('MODIS/006/MCD43A4'); 48 | 49 | // Filter the dataset to a recent date. 50 | var modisDailyRecent = modisDaily.filterDate('2021-11-01'); 51 | 52 | // Add the dataset to the map. 53 | var modisVis = { 54 | bands: [ 55 | 'Nadir_Reflectance_Band1', 56 | 'Nadir_Reflectance_Band4', 57 | 'Nadir_Reflectance_Band3' 58 | ], 59 | min: 0, 60 | max: 4000 61 | }; 62 | Map.addLayer(modisDailyRecent, modisVis, 'MODIS Daily Composite'); 63 | 64 | 65 | // Import the MODIS monthly burned areas dataset. 66 | var modisMonthly = ee.ImageCollection('MODIS/006/MCD64A1'); 67 | 68 | // Filter the dataset to a recent month during fire season. 69 | var modisMonthlyRecent = modisMonthly.filterDate('2021-08-01'); 70 | 71 | // Add the dataset to the map. 72 | Map.addLayer(modisMonthlyRecent, {}, 'MODIS Monthly Burn'); 73 | 74 | // ----------------------------------------------------------------------- 75 | // CHECKPOINT 76 | // ----------------------------------------------------------------------- 77 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F1 - Programming and Remote Sensing Basics/F1.2 Survey of Raster Datasets/F12e-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F1.2 Survey of Raster Datasets 3 | // Checkpoint: F12e 4 | // Authors: Andréa, Karen, Nick Clinton, David Saah 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | ///// 8 | // Other satellite products 9 | ///// 10 | 11 | // Import a Sentinel-5 methane dataset. 12 | var methane = ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_CH4'); 13 | 14 | // Filter the methane dataset. 15 | var methane2018 = methane.select( 16 | 'CH4_column_volume_mixing_ratio_dry_air') 17 | .filterDate('2018-11-28', '2018-11-29') 18 | .first(); 19 | 20 | // Make a visualization for the methane data. 21 | var methaneVis = { 22 | palette: ['black', 'blue', 'purple', 'cyan', 'green', 23 | 'yellow', 'red' 24 | ], 25 | min: 1770, 26 | max: 1920 27 | }; 28 | 29 | // Center the Map. 30 | Map.centerObject(methane2018, 3); 31 | 32 | // Add the methane dataset to the map. 33 | Map.addLayer(methane2018, methaneVis, 'Methane'); 34 | 35 | // Import the ERA5 Monthly dataset 36 | var era5Monthly = ee.ImageCollection('ECMWF/ERA5/MONTHLY'); 37 | 38 | // Filter the dataset 39 | var era5MonthlyTemp = era5Monthly.select('mean_2m_air_temperature') 40 | .filterDate('2018-01-01', '2019-01-31') 41 | .first(); 42 | 43 | // Add the ERA dataset to the map. 44 | Map.addLayer(era5MonthlyTemp, 45 | { 46 | palette: ['yellow', 'red'], 47 | min: 260, 48 | max: 320 49 | }, 50 | 'ERA5 Max Monthly Temp'); 51 | 52 | // ----------------------------------------------------------------------- 53 | // CHECKPOINT 54 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part F - Fundamentals/F1 - Programming and Remote Sensing Basics/F1.2 Survey of Raster Datasets/F12f-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F1.2 Survey of Raster Datasets 3 | // Checkpoint: F12f 4 | // Authors: Andréa, Karen, Nick Clinton, David Saah 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | ///// 8 | // Pre-classified Land Use Land Cover 9 | ///// 10 | 11 | // Import the ESA WorldCover dataset. 12 | var worldCover = ee.ImageCollection('ESA/WorldCover/v100').first(); 13 | 14 | // Center the Map. 15 | Map.centerObject(worldCover, 3); 16 | 17 | // Add the worldCover layer to the map. 18 | Map.addLayer(worldCover, { 19 | bands: ['Map'] 20 | }, 'WorldCover'); 21 | 22 | // Import the Hansen Global Forest Change dataset. 23 | var globalForest = ee.Image( 24 | 'UMD/hansen/global_forest_change_2020_v1_8'); 25 | 26 | // Create a visualization for tree cover in 2000. 27 | var treeCoverViz = { 28 | bands: ['treecover2000'], 29 | min: 0, 30 | max: 100, 31 | palette: ['black', 'green'] 32 | }; 33 | 34 | // Add the 2000 tree cover image to the map. 35 | Map.addLayer(globalForest, treeCoverViz, 'Hansen 2000 Tree Cover'); 36 | 37 | // Create a visualization for the year of tree loss over the past 20 years. 38 | var treeLossYearViz = { 39 | bands: ['lossyear'], 40 | min: 0, 41 | max: 20, 42 | palette: ['yellow', 'red'] 43 | }; 44 | 45 | // Add the 2000-2020 tree cover loss image to the map. 46 | Map.addLayer(globalForest, treeLossYearViz, '2000-2020 Year of Loss'); 47 | 48 | // ----------------------------------------------------------------------- 49 | // CHECKPOINT 50 | // ----------------------------------------------------------------------- 51 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F1 - Programming and Remote Sensing Basics/F1.2 Survey of Raster Datasets/F12g-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F1.2 Survey of Raster Datasets 3 | // Checkpoint: F12g 4 | // Authors: Andréa, Karen, Nick Clinton, David Saah 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | ///// 8 | // Other datasets 9 | ///// 10 | 11 | // Import and filter a gridded population dataset. 12 | var griddedPopulation = ee.ImageCollection( 13 | 'CIESIN/GPWv411/GPW_Population_Count') 14 | .first(); 15 | 16 | // Predefined palette. 17 | var populationPalette = [ 18 | 'ffffe7', 19 | '86a192', 20 | '509791', 21 | '307296', 22 | '2c4484', 23 | '000066' 24 | ]; 25 | 26 | // Center the Map. 27 | Map.centerObject(griddedPopulation, 3); 28 | 29 | // Add the population data to the map. 30 | Map.addLayer(griddedPopulation, 31 | { 32 | min: 0, 33 | max: 1200, 34 | 'palette': populationPalette 35 | }, 36 | 'Gridded Population'); 37 | 38 | // Import the NASA DEM Dataset. 39 | var nasaDEM = ee.Image('NASA/NASADEM_HGT/001'); 40 | 41 | // Add the elevation layer to the map. 42 | Map.addLayer(nasaDEM, { 43 | bands: ['elevation'], 44 | min: 0, 45 | max: 3000 46 | }, 'NASA DEM'); 47 | 48 | // ----------------------------------------------------------------------- 49 | // CHECKPOINT 50 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part F - Fundamentals/F1 - Programming and Remote Sensing Basics/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | # Part F1: Programming and Remote Sensing Basics 30 | 31 |
32 | In order to use Earth Engine well, you will need to develop basic skills in remote sensing and programming. The language of this book is JavaScript, and you will begin by learning how to manipulate variables using it. With that base, you’ll learn about viewing individual satellite images, viewing collections of images in Earth Engine, and how common remote sensing terms are referenced and used in Earth Engine. 33 | 34 | https://google-earth-engine.com/Programming-and-Remote-Sensing-Basics/JavaScript-and-the-Earth-Engine-API/ 35 | 36 | 37 |
38 | 39 | # Invitation for collaborators: 40 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 41 | 42 | https://google-earth-engine.com/contact/ 43 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F1 - Programming and Remote Sensing Basics/​F1.0 JavaScript and the Earth Engine API/F10a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F1.0 Exploring images 3 | // Checkpoint: F10a 4 | // Author: Ujaval Gandhi 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | print('Hello World'); 8 | 9 | var city = 'San Francisco'; 10 | print(city); 11 | 12 | var population = 873965; 13 | print(population); 14 | 15 | var cities = ['San Francisco', 'Los Angeles', 'New York', 'Atlanta']; 16 | print(cities); 17 | 18 | var cityData = { 19 | 'city': 'San Francisco', 20 | 'coordinates': [-122.4194, 37.7749], 21 | 'population': 873965 22 | }; 23 | print(cityData); 24 | 25 | var greet = function(name) { 26 | return 'Hello ' + name; 27 | }; 28 | print(greet('World')); 29 | print(greet('Readers')); 30 | 31 | // This is a comment! 32 | 33 | // ----------------------------------------------------------------------- 34 | // CHECKPOINT 35 | // ----------------------------------------------------------------------- 36 | 37 | 38 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F1 - Programming and Remote Sensing Basics/​F1.0 JavaScript and the Earth Engine API/F10b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F1.0 Exploring images 3 | // Checkpoint: F10b 4 | // Author: Ujaval Gandhi 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | var a = 1; 8 | var b = 2; 9 | 10 | var result = ee.Number(a).add(b); 11 | print(result); 12 | 13 | var yearList = ee.List.sequence(1980, 2020, 5); 14 | print(yearList); 15 | 16 | // ----------------------------------------------------------------------- 17 | // CHECKPOINT 18 | // ----------------------------------------------------------------------- 19 | 20 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F2 - ​Interpreting Images/F2.1 Interpreting an Image Classification/F21a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F2.1 Interpreting an Image: Classification 3 | // Checkpoint: F21a 4 | // Author: Andréa Puzzi Nicolau, Karen Dyson, David Saah, Nicholas Clinton 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Create an Earth Engine Point object over Milan. 8 | var pt = ee.Geometry.Point([9.453, 45.424]); 9 | 10 | // Filter the Landsat 8 collection and select the least cloudy image. 11 | var landsat = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2') 12 | .filterBounds(pt) 13 | .filterDate('2019-01-01', '2020-01-01') 14 | .sort('CLOUD_COVER') 15 | .first(); 16 | 17 | // Center the map on that image. 18 | Map.centerObject(landsat, 8); 19 | 20 | // Add Landsat image to the map. 21 | var visParams = { 22 | bands: ['SR_B4', 'SR_B3', 'SR_B2'], 23 | min: 7000, 24 | max: 12000 25 | }; 26 | Map.addLayer(landsat, visParams, 'Landsat 8 image'); 27 | 28 | // ----------------------------------------------------------------------- 29 | // CHECKPOINT 30 | // ----------------------------------------------------------------------- 31 | 32 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F2 - ​Interpreting Images/F2.2 Accuracy Assessment Quantifying Classification Quality/F22a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F2.2 Accuracy Assessment: Quantifying Classification Quality 3 | // Checkpoint: F22a 4 | // Authors: Andréa Puzzi Nicolau, Karen Dyson, David Saah, Nicholas Clinton 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Import the reference dataset. 8 | var data = ee.FeatureCollection( 9 | 'projects/gee-book/assets/F2-2/milan_data'); 10 | 11 | // Define the prediction bands. 12 | var predictionBands = [ 13 | 'SR_B1', 'SR_B2', 'SR_B3', 'SR_B4', 'SR_B5', 'SR_B6', 'SR_B7', 14 | 'ST_B10', 15 | 'ndvi', 'ndwi' 16 | ]; 17 | 18 | // Split the dataset into training and testing sets. 19 | var trainingTesting = data.randomColumn(); 20 | var trainingSet = trainingTesting 21 | .filter(ee.Filter.lessThan('random', 0.8)); 22 | var testingSet = trainingTesting 23 | .filter(ee.Filter.greaterThanOrEquals('random', 0.8)); 24 | 25 | // Train the Random Forest Classifier with the trainingSet. 26 | var RFclassifier = ee.Classifier.smileRandomForest(50).train({ 27 | features: trainingSet, 28 | classProperty: 'class', 29 | inputProperties: predictionBands 30 | }); 31 | 32 | // Now, to test the classification (verify model's accuracy), 33 | // we classify the testingSet and get a confusion matrix. 34 | var confusionMatrix = testingSet.classify(RFclassifier) 35 | .errorMatrix({ 36 | actual: 'class', 37 | predicted: 'classification' 38 | }); 39 | 40 | // Print the results. 41 | print('Confusion matrix:', confusionMatrix); 42 | print('Overall Accuracy:', confusionMatrix.accuracy()); 43 | print('Producers Accuracy:', confusionMatrix.producersAccuracy()); 44 | print('Consumers Accuracy:', confusionMatrix.consumersAccuracy()); 45 | print('Kappa:', confusionMatrix.kappa()); 46 | 47 | // ----------------------------------------------------------------------- 48 | // CHECKPOINT 49 | // ----------------------------------------------------------------------- 50 | 51 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F2 - ​Interpreting Images/F2.2 Accuracy Assessment Quantifying Classification Quality/F22c-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F2.2 Accuracy Assessment: Quantifying Classification Quality 3 | // Checkpoint: F22c 4 | // Authors: Andréa Puzzi Nicolau, Karen Dyson, David Saah, Nicholas Clinton 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Import the reference dataset. 8 | var data = ee.FeatureCollection( 9 | 'projects/gee-book/assets/F2-2/milan_data'); 10 | 11 | // Define the prediction bands. 12 | var predictionBands = [ 13 | 'SR_B1', 'SR_B2', 'SR_B3', 'SR_B4', 'SR_B5', 'SR_B6', 'SR_B7', 14 | 'ST_B10', 15 | 'ndvi', 'ndwi' 16 | ]; 17 | 18 | // Split the dataset into training and testing sets. 19 | var trainingTesting = data.randomColumn(); 20 | var trainingSet = trainingTesting 21 | .filter(ee.Filter.lessThan('random', 0.8)); 22 | var testingSet = trainingTesting 23 | .filter(ee.Filter.greaterThanOrEquals('random', 0.8)); 24 | 25 | // Spatial join. 26 | var distFilter = ee.Filter.withinDistance({ 27 | distance: 1000, 28 | leftField: '.geo', 29 | rightField: '.geo', 30 | maxError: 10 31 | }); 32 | 33 | var join = ee.Join.inverted(); 34 | 35 | var trainingSet = join.apply(trainingSet, testingSet, distFilter); 36 | 37 | // Train the Random Forest Classifier with the trainingSet. 38 | var RFclassifier = ee.Classifier.smileRandomForest(50).train({ 39 | features: trainingSet, 40 | classProperty: 'class', 41 | inputProperties: predictionBands 42 | }); 43 | 44 | // Now, to test the classification (verify model's accuracy), 45 | // we classify the testingSet and get a confusion matrix. 46 | var confusionMatrix = testingSet.classify(RFclassifier) 47 | .errorMatrix({ 48 | actual: 'class', 49 | predicted: 'classification' 50 | }); 51 | 52 | // Print the results. 53 | print('Confusion matrix:', confusionMatrix); 54 | print('Overall Accuracy:', confusionMatrix.accuracy()); 55 | print('Producers Accuracy:', confusionMatrix.producersAccuracy()); 56 | print('Consumers Accuracy:', confusionMatrix.consumersAccuracy()); 57 | print('Kappa:', confusionMatrix.kappa()); 58 | 59 | // ----------------------------------------------------------------------- 60 | // CHECKPOINT 61 | // ----------------------------------------------------------------------- 62 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F2 - ​Interpreting Images/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | # Part F2: Interpreting Images 30 | 31 |
32 | Now that you know how images are viewed and what kinds of images exist in Earth Engine, how do we manipulate them? To gain the skills of interpreting images, you’ll work with bands, combining values to form indices and masking unwanted pixels. Then, you’ll learn some of the techniques available in Earth Engine for classifying images and interpreting the results. 33 | 34 | https://google-earth-engine.com/Interpreting-Images/Image-Manipulation-Bands-Arithmetic-Thresholds-and-Masks/ 35 | 36 | 37 | 38 | # Invitation for collaborators: 39 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 40 | 41 | https://google-earth-engine.com/contact/ 42 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F2 - ​Interpreting Images/​F2.0 Image Manipulation Bands, Arithmetic, Thresholds, and Masks/F20a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F2.0 Image Manipulation: Bands, Arithmetic, Thresholds, and Masks 3 | // Checkpoint: F20a 4 | // Authors: Karen Dyson, Andrea Puzzi Nicolau, David Saah, and Nicholas Clinton 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | ///// 8 | // Band Arithmetic 9 | ///// 10 | 11 | // Calculate NDVI using Sentinel 2 12 | 13 | // Import and filter imagery by location and date. 14 | var sfoPoint = ee.Geometry.Point(-122.3774, 37.6194); 15 | var sfoImage = ee.ImageCollection('COPERNICUS/S2') 16 | .filterBounds(sfoPoint) 17 | .filterDate('2020-02-01', '2020-04-01') 18 | .first(); 19 | 20 | // Display the image as a false color composite. 21 | Map.centerObject(sfoImage, 11); 22 | Map.addLayer(sfoImage, { 23 | bands: ['B8', 'B4', 'B3'], 24 | min: 0, 25 | max: 2000 26 | }, 'False color'); 27 | 28 | // Extract the near infrared and red bands. 29 | var nir = sfoImage.select('B8'); 30 | var red = sfoImage.select('B4'); 31 | 32 | // Calculate the numerator and the denominator using subtraction and addition respectively. 33 | var numerator = nir.subtract(red); 34 | var denominator = nir.add(red); 35 | 36 | // Now calculate NDVI. 37 | var ndvi = numerator.divide(denominator); 38 | 39 | // Add the layer to our map with a palette. 40 | var vegPalette = ['red', 'white', 'green']; 41 | Map.addLayer(ndvi, { 42 | min: -1, 43 | max: 1, 44 | palette: vegPalette 45 | }, 'NDVI Manual'); 46 | 47 | // Now use the built-in normalizedDifference function to achieve the same outcome. 48 | var ndviND = sfoImage.normalizedDifference(['B8', 'B4']); 49 | Map.addLayer(ndviND, { 50 | min: -1, 51 | max: 1, 52 | palette: vegPalette 53 | }, 'NDVI normalizedDiff'); 54 | 55 | // Use normalizedDifference to calculate NDWI 56 | var ndwi = sfoImage.normalizedDifference(['B8', 'B11']); 57 | var waterPalette = ['white', 'blue']; 58 | Map.addLayer(ndwi, { 59 | min: -0.5, 60 | max: 1, 61 | palette: waterPalette 62 | }, 'NDWI'); 63 | 64 | // ----------------------------------------------------------------------- 65 | // CHECKPOINT 66 | // ----------------------------------------------------------------------- 67 | 68 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F3 - Advanced Image Processing/F3.1 Advanced Pixel-based Image Transformation/F31a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F3.1 Advanced Pixel-Based Image Transformations 3 | // Checkpoint: F31a 4 | // Authors: Karen, Andrea, Nick, and David 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Import and filter imagery by location and date. 8 | var sfoPoint = ee.Geometry.Point(-122.3774, 37.6194); 9 | 10 | var sfoImage = ee.ImageCollection('COPERNICUS/S2') 11 | .filterBounds(sfoPoint) 12 | .filterDate('2020-02-01', '2020-04-01') 13 | .first(); 14 | Map.centerObject(sfoImage, 11); 15 | 16 | // Calculate EVI using Sentinel 2 17 | 18 | // Extract the bands and divide by 10,000 to account for scaling done. 19 | var nirScaled = sfoImage.select('B8').divide(10000); 20 | var redScaled = sfoImage.select('B4').divide(10000); 21 | var blueScaled = sfoImage.select('B2').divide(10000); 22 | 23 | // Calculate the numerator, note that order goes from left to right. 24 | var numeratorEVI = (nirScaled.subtract(redScaled)).multiply(2.5); 25 | 26 | // Calculate the denominator. 27 | var denomClause1 = redScaled.multiply(6); 28 | var denomClause2 = blueScaled.multiply(7.5); 29 | var denominatorEVI = nirScaled.add(denomClause1) 30 | .subtract(denomClause2).add(1); 31 | 32 | // Calculate EVI and name it. 33 | var EVI = numeratorEVI.divide(denominatorEVI).rename('EVI'); 34 | 35 | // And now map EVI using our vegetation palette. 36 | var vegPalette = ['red', 'white', 'green']; 37 | var visParams = {min: -1, max: 1, palette: vegPalette}; 38 | Map.addLayer(EVI, visParams, 'EVI'); 39 | 40 | // Calculate EVI. 41 | var eviExpression = sfoImage.expression({ 42 | expression: '2.5 * ((NIR - RED) / (NIR + 6 * RED - 7.5 * BLUE + 1))', 43 | map: { // Map between variables in the expression and images. 44 | 'NIR': sfoImage.select('B8').divide(10000), 45 | 'RED': sfoImage.select('B4').divide(10000), 46 | 'BLUE': sfoImage.select('B2').divide(10000) 47 | } 48 | }); 49 | 50 | // And now map EVI using our vegetation palette. 51 | Map.addLayer(eviExpression, visParams, 'EVI Expression'); 52 | 53 | // ----------------------------------------------------------------------- 54 | // CHECKPOINT 55 | // ----------------------------------------------------------------------- 56 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F3 - Advanced Image Processing/F3.1 Advanced Pixel-based Image Transformation/F31b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F3.1 Advanced Pixel-Based Image Transformations 3 | // Checkpoint: F31b 4 | // Authors: Karen, Andrea, Nick, and David 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Examine the true-color Landsat 8 images for the 2013 Rim Fire. 8 | var burnImage = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA') 9 | .filterBounds(ee.Geometry.Point(-120.083, 37.850)) 10 | .filterDate('2013-09-15', '2013-09-27') 11 | .sort('CLOUD_COVER') 12 | .first(); 13 | 14 | Map.centerObject(ee.Geometry.Point(-120.083, 37.850), 11); 15 | 16 | var rgbParams = { 17 | bands: ['B4', 'B3', 'B2'], 18 | min: 0, 19 | max: 0.3 20 | }; 21 | Map.addLayer(burnImage, rgbParams, 'True-Color Burn Image'); 22 | 23 | // Calculate BAI. 24 | var bai = burnImage.expression( 25 | '1.0 / ((0.1 - RED)**2 + (0.06 - NIR)**2)', { 26 | 'NIR': burnImage.select('B5'), 27 | 'RED': burnImage.select('B4'), 28 | }); 29 | 30 | // Display the BAI image. 31 | var burnPalette = ['green', 'blue', 'yellow', 'red']; 32 | Map.addLayer(bai, { 33 | min: 0, 34 | max: 400, 35 | palette: burnPalette 36 | }, 'BAI'); 37 | 38 | // ----------------------------------------------------------------------- 39 | // CHECKPOINT 40 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part F - Fundamentals/F3 - Advanced Image Processing/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | # Part F3: Advanced Image Processing 30 | 31 | Once you understand the basics of processing images in Earth Engine, this Part will present some of the more advanced processing tools available for treating individual images. These include creating regressions among image bands, transforming images with pixel-based and neighborhood-based techniques, and grouping individual pixels into objects that can then be classified. 32 | 33 | https://google-earth-engine.com/Advanced-Image-Processing/Interpreting-an-Image-Regression/ 34 | 35 | 36 | # Invitation for collaborators: 37 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 38 | 39 | https://google-earth-engine.com/contact/ 40 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.1 Exploring Image Collections/F41a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.1 Exploring Image Collections 3 | // Checkpoint: F41a 4 | // Author: Gennadii Donchyts 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Define a region of interest as a point in Lisbon, Portugal. 8 | var lisbonPoint = ee.Geometry.Point(-9.179473, 38.763948); 9 | 10 | // Center the map at that point. 11 | Map.centerObject(lisbonPoint, 16); 12 | 13 | // filter the large ImageCollection to be just images from 2020 14 | // around Lisbon. From each image, select true-color bands to draw 15 | var filteredIC = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA') 16 | .filterDate('2020-01-01', '2021-01-01') 17 | .filterBounds(lisbonPoint) 18 | .select(['B6', 'B5', 'B4']); 19 | 20 | // Add the filtered ImageCollection so that we can inspect values 21 | // via the Inspector tool 22 | Map.addLayer(filteredIC, {}, 'TOA image collection'); 23 | 24 | // Construct a chart using values queried from image collection. 25 | var chart = ui.Chart.image.series({ 26 | imageCollection: filteredIC, 27 | region: lisbonPoint, 28 | reducer: ee.Reducer.first(), 29 | scale: 10 30 | }); 31 | 32 | // Show the chart in the Console. 33 | print(chart); 34 | 35 | // ----------------------------------------------------------------------- 36 | // CHECKPOINT 37 | // ----------------------------------------------------------------------- 38 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.1 Exploring Image Collections/F41b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.1 Exploring Image Collections 3 | // Checkpoint: F41b 4 | // Author: Gennadii Donchyts 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Define a region of interest as a point in Lisbon, Portugal. 8 | var lisbonPoint = ee.Geometry.Point(-9.179473, 38.763948); 9 | 10 | // Center the map at that point. 11 | Map.centerObject(lisbonPoint, 16); 12 | 13 | // filter the large ImageCollection to be just images from 2020 14 | // around Lisbon. From each image, select true-color bands to draw 15 | var filteredIC = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA') 16 | .filterDate('2020-01-01', '2021-01-01') 17 | .filterBounds(lisbonPoint) 18 | .select(['B6', 'B5', 'B4']); 19 | 20 | // Add the filtered ImageCollection so that we can inspect values 21 | // via the Inspector tool 22 | Map.addLayer(filteredIC, {}, 'TOA image collection'); 23 | 24 | // Construct a chart using values queried from image collection. 25 | var chart = ui.Chart.image.series({ 26 | imageCollection: filteredIC, 27 | region: lisbonPoint, 28 | reducer: ee.Reducer.first(), 29 | scale: 10 30 | }); 31 | 32 | // Show the chart in the Console. 33 | print(chart); 34 | 35 | // ----------------------------------------------------------------------- 36 | // CHECKPOINT 37 | // ----------------------------------------------------------------------- 38 | 39 | // compute and show the number of observations in an image collection 40 | var count = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA') 41 | .filterDate('2020-01-01', '2021-01-01') 42 | .select(['B6']) 43 | .count(); 44 | 45 | // add white background and switch to HYBRID basemap 46 | Map.addLayer(ee.Image(1), { 47 | palette: ['white'] 48 | }, 'white', true, 0.5); 49 | Map.setOptions('HYBRID'); 50 | 51 | // show image count 52 | Map.addLayer(count, { 53 | min: 0, 54 | max: 50, 55 | palette: ['d7191c', 'fdae61', 'ffffbf', 'a6d96a', 56 | '1a9641'] 57 | }, 'landsat 8 image count (2020)'); 58 | 59 | // Center the map at that point. 60 | Map.centerObject(lisbonPoint, 5); 61 | 62 | // ----------------------------------------------------------------------- 63 | // CHECKPOINT 64 | // ----------------------------------------------------------------------- 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.2 Aggregating Images for Time Series/F42a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.2 Aggregating Images for Time Series 3 | // Checkpoint: F42a 4 | // Author: Ujaval Gandhi 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | var chirps = ee.ImageCollection('UCSB-CHG/CHIRPS/PENTAD'); 8 | var startDate = '2019-01-01'; 9 | var endDate = '2020-01-01'; 10 | var yearFiltered = chirps.filter(ee.Filter.date(startDate, endDate)); 11 | 12 | print(yearFiltered, 'Date-filtered CHIRPS images'); 13 | 14 | 15 | // ----------------------------------------------------------------------- 16 | // CHECKPOINT 17 | // ----------------------------------------------------------------------- 18 | 19 | 20 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.2 Aggregating Images for Time Series/F42b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.2 Aggregating Images for Time Series 3 | // Checkpoint: F42b 4 | // Author: Ujaval Gandhi 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | var chirps = ee.ImageCollection('UCSB-CHG/CHIRPS/PENTAD'); 8 | var year = 2019; 9 | var startDate = ee.Date.fromYMD(year, 1, 1); 10 | 11 | var endDate = startDate.advance(1, 'year'); 12 | 13 | var yearFiltered = chirps 14 | .filter(ee.Filter.date(startDate, endDate)); 15 | print(yearFiltered, 'Date-filtered CHIRPS images'); 16 | 17 | print(startDate, 'Start date'); 18 | print(endDate, 'End date'); 19 | 20 | print('Start date as timestamp', startDate.millis()); 21 | print('End date as timestamp', endDate.millis()); 22 | 23 | // ----------------------------------------------------------------------- 24 | // CHECKPOINT 25 | // ----------------------------------------------------------------------- 26 | 27 | 28 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.2 Aggregating Images for Time Series/F42c-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.2 Aggregating Images for Time Series 3 | // Checkpoint: F42c 4 | // Author: Ujaval Gandhi 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | var chirps = ee.ImageCollection('UCSB-CHG/CHIRPS/PENTAD'); 8 | var year = 2019; 9 | var startDate = ee.Date.fromYMD(year, 1, 1); 10 | 11 | var endDate = startDate.advance(1, 'year'); 12 | 13 | var yearFiltered = chirps 14 | .filter(ee.Filter.date(startDate, endDate)); 15 | print(yearFiltered, 'Date-filtered CHIRPS images'); 16 | 17 | print(startDate, 'Start date'); 18 | print(endDate, 'End date'); 19 | 20 | print('Start date as timestamp', startDate.millis()); 21 | print('End date as timestamp', endDate.millis()); 22 | 23 | // ----------------------------------------------------------------------- 24 | // CHECKPOINT 25 | // ----------------------------------------------------------------------- 26 | 27 | // Aggregate this time series to compute monthly images. 28 | // Create a list of months 29 | var months = ee.List.sequence(1, 12); 30 | 31 | // Write a function that takes a month number 32 | // and returns a monthly image. 33 | var createMonthlyImage = function(beginningMonth) { 34 | var startDate = ee.Date.fromYMD(year, beginningMonth, 1); 35 | var endDate = startDate.advance(1, 'month'); 36 | var monthFiltered = yearFiltered 37 | .filter(ee.Filter.date(startDate, endDate)); 38 | 39 | // Calculate total precipitation. 40 | var total = monthFiltered.reduce(ee.Reducer.sum()); 41 | return total.set({ 42 | 'system:time_start': startDate.millis(), 43 | 'system:time_end': endDate.millis(), 44 | 'year': year, 45 | 'month': beginningMonth 46 | }); 47 | }; 48 | 49 | // map() the function on the list of months 50 | // This creates a list with images for each month in the list 51 | var monthlyImages = months.map(createMonthlyImage); 52 | 53 | // Create an ee.ImageCollection. 54 | var monthlyCollection = ee.ImageCollection.fromImages(monthlyImages); 55 | print(monthlyCollection); 56 | 57 | // ----------------------------------------------------------------------- 58 | // CHECKPOINT 59 | // ----------------------------------------------------------------------- 60 | 61 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.3 Clouds and Image Compositing/F43c-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.3 Clouds and Image Compositing 3 | // Checkpoint: F43c 4 | // Authors: Txomin Hermosilla, Saverio Francini, Andréa P. Nicolau, 5 | // Michael A. Wulder, Joanne C. White, Nicholas C. Coops, 6 | // Gherardo Chirici 7 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 | 9 | // Access the GEE-BAP interface at the following link, 10 | // by copy-pasting the line below into your browser. 11 | 12 | // https://code.earthengine.google.com/?accept_repo=users/sfrancini/bap 13 | 14 | // This will create a repository on your Earth Engine account. 15 | // The repository will appear in the Reader section of the Scripts panel. 16 | 17 | // To access the user interface, open the “ui” script and click Run. 18 | 19 | // You can find more information about GEE-BAP at: 20 | // https://github.com/saveriofrancini/bap 21 | 22 | // ----------------------------------------------------------------------- 23 | // CHECKPOINT 24 | // ----------------------------------------------------------------------- 25 | 26 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.3 Clouds and Image Compositing/F43d-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.3 Clouds and Image Compositing 3 | // Checkpoint: F43d 4 | // Authors: Txomin Hermosilla, Saverio Francini, Andréa P. Nicolau, 5 | // Michael A. Wulder, Joanne C. White, Nicholas C. Coops, 6 | // Gherardo Chirici 7 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 | 9 | // Define required parameters. 10 | var targetDay = '06-01'; 11 | var daysRange = 75; 12 | var cloudsTh = 70; 13 | var SLCoffPenalty = 0.7; 14 | var opacityScoreMin = 0.2; 15 | var opacityScoreMax = 0.3; 16 | var cloudDistMax = 1500; 17 | var despikeTh = 0.65; 18 | var despikeNbands = 3; 19 | var startYear = 2015; 20 | var endYear = 2017; 21 | 22 | // Define study area. 23 | var worldCountries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017'); 24 | var colombia = worldCountries.filter(ee.Filter.eq('country_na', 25 | 'Colombia')); 26 | 27 | // Load the bap library. 28 | var library = require('users/sfrancini/bap:library'); 29 | 30 | // Calculate BAP. 31 | var BAPCS = library.BAP(null, targetDay, daysRange, cloudsTh, 32 | SLCoffPenalty, opacityScoreMin, opacityScoreMax, cloudDistMax); 33 | 34 | // Despike the collection. 35 | BAPCS = library.despikeCollection(despikeTh, despikeNbands, BAPCS, 36 | 1984, 2021, true); 37 | 38 | // Infill datagaps. 39 | BAPCS = library.infill(BAPCS, 1984, 2021, false, true); 40 | 41 | // Visualize the image. 42 | Map.centerObject(colombia, 5); 43 | library.ShowCollection(BAPCS, startYear, endYear, colombia, false, 44 | null); 45 | library.AddSLider(startYear, endYear); 46 | 47 | // ----------------------------------------------------------------------- 48 | // CHECKPOINT 49 | // ----------------------------------------------------------------------- 50 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.4 Change Detection/F44a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.4 Change Detection 3 | // Checkpoint: F44a 4 | // Author: Karis Tenneson, John Dilger, Crystal Wespestad, Brian Zutta, 5 | // Andréa P Nicolau, Karen Dyson 6 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 | 8 | var landsat8 = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2') 9 | .select( 10 | ['SR_B2', 'SR_B3', 'SR_B4', 'SR_B5', 'SR_B6', 'SR_B7'], 11 | ['blue', 'green', 'red', 'nir', 'swir1', 'swir2'] 12 | ); 13 | 14 | var point = ee.Geometry.Point([-123.64, 42.96]); 15 | Map.centerObject(point, 11); 16 | 17 | var preImage = landsat8 18 | .filterBounds(point) 19 | .filterDate('2013-06-01', '2013-06-30') 20 | .sort('CLOUD_COVER', true) 21 | .first(); 22 | 23 | var postImage = landsat8 24 | .filterBounds(point) 25 | .filterDate('2020-06-01', '2020-06-30') 26 | .sort('CLOUD_COVER', true) 27 | .first(); 28 | 29 | var visParam = { 30 | 'bands': ['swir2', 'nir', 'red'], 31 | 'min': 7750, 32 | 'max': 22200 33 | }; 34 | Map.addLayer(preImage, visParam, 'pre'); 35 | Map.addLayer(postImage, visParam, 'post'); 36 | 37 | // Calculate NBR. 38 | var nbrPre = preImage.normalizedDifference(['nir', 'swir2']) 39 | .rename('nbr_pre'); 40 | var nbrPost = postImage.normalizedDifference(['nir', 'swir2']) 41 | .rename('nbr_post'); 42 | 43 | // ----------------------------------------------------------------------- 44 | // CHECKPOINT 45 | // ----------------------------------------------------------------------- 46 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.4 Change Detection/F44b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.4 Change Detection 3 | // Checkpoint: F44b 4 | // Author: Karis Tenneson, John Dilger, Crystal Wespestad, Brian Zutta, 5 | // Andréa P Nicolau, Karen Dyson 6 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 | 8 | var landsat8 = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2') 9 | .select( 10 | ['SR_B2', 'SR_B3', 'SR_B4', 'SR_B5', 'SR_B6', 'SR_B7'], 11 | ['blue', 'green', 'red', 'nir', 'swir1', 'swir2'] 12 | ); 13 | 14 | var point = ee.Geometry.Point([-123.64, 42.96]); 15 | Map.centerObject(point, 11); 16 | 17 | var preImage = landsat8 18 | .filterBounds(point) 19 | .filterDate('2013-06-01', '2013-06-30') 20 | .sort('CLOUD_COVER', true) 21 | .first(); 22 | 23 | var postImage = landsat8 24 | .filterBounds(point) 25 | .filterDate('2020-06-01', '2020-06-30') 26 | .sort('CLOUD_COVER', true) 27 | .first(); 28 | 29 | var visParam = { 30 | 'bands': ['swir2', 'nir', 'red'], 31 | 'min': 7750, 32 | 'max': 22200 33 | }; 34 | Map.addLayer(preImage, visParam, 'pre'); 35 | Map.addLayer(postImage, visParam, 'post'); 36 | 37 | // Calculate NBR. 38 | var nbrPre = preImage.normalizedDifference(['nir', 'swir2']) 39 | .rename('nbr_pre'); 40 | var nbrPost = postImage.normalizedDifference(['nir', 'swir2']) 41 | .rename('nbr_post'); 42 | 43 | // ----------------------------------------------------------------------- 44 | // CHECKPOINT 45 | // ----------------------------------------------------------------------- 46 | 47 | // 2-date change. 48 | var diff = nbrPost.subtract(nbrPre).rename('change'); 49 | 50 | var palette = [ 51 | '011959', '0E365E', '1D5561', '3E6C55', '687B3E', 52 | '9B882E', 'D59448', 'F9A380', 'FDB7BD', 'FACCFA' 53 | ]; 54 | var visParams = { 55 | palette: palette, 56 | min: -0.2, 57 | max: 0.2 58 | }; 59 | Map.addLayer(diff, visParams, 'change'); 60 | 61 | // Classify change 62 | var thresholdGain = 0.10; 63 | var thresholdLoss = -0.10; 64 | 65 | var diffClassified = ee.Image(0); 66 | 67 | diffClassified = diffClassified.where(diff.lte(thresholdLoss), 2); 68 | diffClassified = diffClassified.where(diff.gte(thresholdGain), 1); 69 | 70 | var changeVis = { 71 | palette: 'fcffc8,2659eb,fa1373', 72 | min: 0, 73 | max: 2 74 | }; 75 | 76 | Map.addLayer(diffClassified.selfMask(), 77 | changeVis, 78 | 'change classified by threshold'); 79 | 80 | // ----------------------------------------------------------------------- 81 | // CHECKPOINT 82 | // ----------------------------------------------------------------------- 83 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.4 Change Detection/vis/incheon.js: -------------------------------------------------------------------------------- 1 | var landsat8 = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2') 2 | .select( 3 | ['SR_B2', 'SR_B3', 'SR_B4', 'SR_B5', 'SR_B6', 'SR_B7'], 4 | ['blue', 'green', 'red', 'nir', 'swir1', 'swir2']); 5 | var landsat3 = ee.ImageCollection('LANDSAT/LM03/C01/T2') 6 | .select(['B4', 'B5', 'B6', 'B7'], ['green', 'red', 'nir1', 'nir2']); 7 | 8 | var preImage = landsat3 9 | .filterBounds(point) 10 | .filterDate('1981-01-01', '1981-12-30') 11 | .sort('CLOUD_COVER', true) 12 | .first(); 13 | var postImage = landsat8 14 | .filterBounds(point) 15 | .filterDate('2020-01-01', '2020-12-30') 16 | .sort('CLOUD_COVER', true) 17 | .first(); 18 | 19 | Map.centerObject(point, 10); 20 | Map.addLayer(preImage, preIncheon, 'pre'); 21 | Map.addLayer(postImage, postIncheon, 'post'); 22 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.4 Change Detection/vis/mining.js: -------------------------------------------------------------------------------- 1 | var landsat8 = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2') 2 | .select( 3 | ['SR_B2', 'SR_B3', 'SR_B4', 'SR_B5', 'SR_B6', 'SR_B7'], 4 | ['blue', 'green', 'red', 'nir', 'swir1', 'swir2']); 5 | var landsat5 = ee.ImageCollection('LANDSAT/LT05/C01/T2_SR') 6 | .select( 7 | ['B1', 'B2', 'B3', 'B4', 'B5', 'B7'], 8 | ['blue', 'green', 'red', 'nir', 'swir1', 'swir2']); 9 | 10 | var preImage = landsat5 11 | .filterBounds(point) 12 | .filterDate('1985-01-01', '2002-12-30') 13 | .sort('CLOUD_COVER', true) 14 | .first(); 15 | var postImage = landsat8 16 | .filterBounds(point) 17 | .filterDate('2020-01-01', '2020-12-30') 18 | .sort('CLOUD_COVER', true) 19 | .first(); 20 | 21 | Map.centerObject(point, 10); 22 | Map.addLayer(preImage, miningPreVis, 'pre'); 23 | Map.addLayer(postImage, mininPostVis, 'post'); -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.4 Change Detection/vis/mtSHelen.js: -------------------------------------------------------------------------------- 1 | var landsat2 = ee.ImageCollection('LANDSAT/LM02/C02/T2') 2 | .select(['B4', 'B5', 'B6', 'B7'], 3 | ['green', 'red', 'nir1', 'nir2']); 4 | 5 | var preImage = landsat2 6 | .filterBounds(point) 7 | .filterDate('1979-08-01', '1979-10-30') 8 | .sort('CLOUD_COVER', true) 9 | .first(); 10 | var postImage = landsat2 11 | .filterBounds(point) 12 | .filterDate('1980-04-01', '1981-10-30') 13 | .sort('CLOUD_COVER', true) 14 | .first(); 15 | 16 | var visParam = { 17 | 'opacity': 1, 18 | 'bands': ['nir1', 'red', 'green'], 19 | 'min': 0, 20 | 'max': 128, 21 | 'gamma':1 22 | }; 23 | 24 | Map.centerObject(point, 10); 25 | Map.addLayer(preImage, visParam, 'pre'); 26 | Map.addLayer(postImage, visParam, 'post'); 27 | 28 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.4 Change Detection/vis/paradise.js: -------------------------------------------------------------------------------- 1 | var landsat8 = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2') 2 | .select( 3 | ['SR_B2', 'SR_B3', 'SR_B4', 'SR_B5', 'SR_B6', 'SR_B7'], 4 | ['blue', 'green', 'red', 'nir', 'swir1', 'swir2']); 5 | 6 | var preImage = landsat8 7 | .filterBounds(point) 8 | .filterDate('2018-10-01', '2018-10-30') 9 | .sort('CLOUD_COVER', true) 10 | .first(); 11 | var postImage = landsat8 12 | .filterBounds(point) 13 | .filterDate('2018-12-01', '2019-04-30') 14 | .sort('CLOUD_COVER', true) 15 | .first(); 16 | 17 | Map.centerObject(point, 10); 18 | Map.addLayer(preImage, imageVisParam, 'pre'); 19 | Map.addLayer(postImage, imageVisParam, 'post'); 20 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.5 Interpreting Annual Time Series with LandTrendr/F45a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.5 Interpreting Annual Time Series with LandTrendr 3 | // Checkpoint: F45a 4 | // Authors: Robert Kennedy, Justin Braaten, Peter Clary 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // material is in the section for this chapter. 8 | // Or you can dig into the script-based application of these same concepts by exploring the more 9 | // expansive set of manuals on the https://emapr.github.io/LT-GEE/ site. 10 | 11 | 12 | // LandTrendr Github manual. A link to this material is available in the book’s repository in the section for this chapter. . , available at https://emapr.github.io/LT-GEE/. Th 13 | 14 | // (Find the script at users/emaprlab/public/LT-data-download/LT-Data-Visualization-Download-App_v1.0.) 15 | 16 | // Detailed instructions and script links for application of the LandTrendr algorithms are covered in substantial depth in the LandTrendr Github manual. We have provided functions that simplify the use of LandTrendr, with sample scripts that can be adapted to a variety of situations. 17 | // A link to this material is available in the book’s repository in the section for this chapter. . , available at https://emapr.github.io/LT-GEE/. 18 | 19 | // ----------------------------------------------------------------------- 20 | // CHECKPOINT 21 | // ----------------------------------------------------------------------- 22 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.7 Interpreting Time Series with CCDC/F47a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.7 Interpreting Time Series with CCDC 3 | // Checkpoint: F47a 4 | // Authors: Paulo Arévalo, Pontus Olofsson 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Access the CCDC interface at the following link, 8 | // by copy-pasting the line below into your browser. 9 | 10 | 11 | // https://parevalo-bu.users.earthengine.app/view/advanced-tstools 12 | 13 | // This will open an app that you can use to explore time series and familiarize 14 | // yourself with CCDC capabilities 15 | 16 | // ----------------------------------------------------------------------- 17 | // CHECKPOINT 18 | // ----------------------------------------------------------------------- 19 | 20 | 21 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.7 Interpreting Time Series with CCDC/F47b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.7 Interpreting Time Series with CCDC 3 | // Checkpoint: F47b 4 | // Authors: Paulo Arévalo, Pontus Olofsson 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | var utils = require( 8 | 'users/parevalo_bu/gee-ccdc-tools:ccdcUtilities/api'); 9 | 10 | var studyRegion = ee.Geometry.Rectangle([ 11 | [-63.9533, -10.1315], 12 | [-64.9118, -10.6813] 13 | ]); 14 | 15 | // Define start, end dates and Landsat bands to use. 16 | var startDate = '2000-01-01'; 17 | var endDate = '2020-01-01'; 18 | var bands = ['BLUE', 'GREEN', 'RED', 'NIR', 'SWIR1', 'SWIR2']; 19 | 20 | // Retrieve all clear, Landsat 4, 5, 7 and 8 observations (Collection 2, Tier 1). 21 | var filteredLandsat = utils.Inputs.getLandsat({ 22 | collection: 2 23 | }) 24 | .filterBounds(studyRegion) 25 | .filterDate(startDate, endDate) 26 | .select(bands); 27 | 28 | print(filteredLandsat.first()); 29 | 30 | // Set CCD params to use. 31 | var ccdParams = { 32 | breakpointBands: ['GREEN', 'RED', 'NIR', 'SWIR1', 'SWIR2'], 33 | tmaskBands: ['GREEN', 'SWIR2'], 34 | minObservations: 6, 35 | chiSquareProbability: 0.99, 36 | minNumOfYearsScaler: 1.33, 37 | dateFormat: 1, 38 | lambda: 0.002, 39 | maxIterations: 10000, 40 | collection: filteredLandsat 41 | }; 42 | 43 | // Run CCD. 44 | var ccdResults = ee.Algorithms.TemporalSegmentation.Ccdc(ccdParams); 45 | print(ccdResults); 46 | 47 | var exportResults = false; 48 | if (exportResults) { 49 | // Create a metadata dictionary with the parameters and arguments used. 50 | var metadata = ccdParams; 51 | metadata['breakpointBands'] = metadata['breakpointBands'].toString(); 52 | metadata['tmaskBands'] = metadata['tmaskBands'].toString(); 53 | metadata['startDate'] = startDate; 54 | metadata['endDate'] = endDate; 55 | metadata['bands'] = bands.toString(); 56 | 57 | // Export results, assigning the metadata as image properties. 58 | // 59 | Export.image.toAsset({ 60 | image: ccdResults.set(metadata), 61 | region: studyRegion, 62 | pyramidingPolicy: { 63 | ".default": 'sample' 64 | }, 65 | scale: 30 66 | }); 67 | } 68 | 69 | // ----------------------------------------------------------------------- 70 | // CHECKPOINT 71 | // ----------------------------------------------------------------------- 72 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.7 Interpreting Time Series with CCDC/F47c-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.7 Interpreting Time Series with CCDC 3 | // Checkpoint: F47c 4 | // Authors: Paulo Arévalo, Pontus Olofsson 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | var palettes = require('users/gena/packages:palettes'); 8 | 9 | var resultsPath = 10 | 'projects/gee-book/assets/F4-7/Rondonia_example_small'; 11 | var ccdResults = ee.Image(resultsPath); 12 | Map.centerObject(ccdResults, 10); 13 | print(ccdResults); 14 | 15 | // Select time of break and change probability array images. 16 | var change = ccdResults.select('tBreak'); 17 | var changeProb = ccdResults.select('changeProb'); 18 | 19 | // Set the time range we want to use and get as mask of 20 | // places that meet the condition. 21 | var start = 2000; 22 | var end = 2021; 23 | var mask = change.gt(start).and(change.lte(end)).and(changeProb.eq( 24 | 1)); 25 | Map.addLayer(changeProb, {}, 'change prob'); 26 | 27 | // Obtain the number of breaks for the time range. 28 | var numBreaks = mask.arrayReduce(ee.Reducer.sum(), [0]); 29 | Map.addLayer(numBreaks, { 30 | min: 0, 31 | max: 5 32 | }, 'Number of breaks'); 33 | 34 | // Obtain the first change in that time period. 35 | var dates = change.arrayMask(mask).arrayPad([1]); 36 | var firstChange = dates 37 | .arraySlice(0, 0, 1) 38 | .arrayFlatten([ 39 | ['firstChange'] 40 | ]) 41 | .selfMask(); 42 | 43 | var timeVisParams = { 44 | palette: palettes.colorbrewer.YlOrRd[9], 45 | min: start, 46 | max: end 47 | }; 48 | Map.addLayer(firstChange, timeVisParams, 'First change'); 49 | 50 | // Obtain the last change in that time period. 51 | var lastChange = dates 52 | .arraySlice(0, -1) 53 | .arrayFlatten([ 54 | ['lastChange'] 55 | ]) 56 | .selfMask(); 57 | Map.addLayer(lastChange, timeVisParams, 'Last change'); 58 | 59 | // Get masked magnitudes. 60 | var magnitudes = ccdResults 61 | .select('SWIR1_magnitude') 62 | .arrayMask(mask) 63 | .arrayPad([1]); 64 | 65 | // Get index of max abs magnitude of change. 66 | var maxIndex = magnitudes 67 | .abs() 68 | .arrayArgmax() 69 | .arrayFlatten([ 70 | ['index'] 71 | ]); 72 | 73 | // Select max magnitude and its timing 74 | var selectedMag = magnitudes.arrayGet(maxIndex); 75 | var selectedTbreak = dates.arrayGet(maxIndex).selfMask(); 76 | 77 | var magVisParams = { 78 | palette: palettes.matplotlib.viridis[7], 79 | min: -0.15, 80 | max: 0.15 81 | }; 82 | Map.addLayer(selectedMag, magVisParams, 'Max mag'); 83 | Map.addLayer(selectedTbreak, timeVisParams, 'Time of max mag'); 84 | 85 | // ----------------------------------------------------------------------- 86 | // CHECKPOINT 87 | // ----------------------------------------------------------------------- 88 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.7 Interpreting Time Series with CCDC/F47d-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.7 Interpreting Time Series with CCDC 3 | // Checkpoint: F47d 4 | // Authors: Paulo Arévalo, Pontus Olofsson 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | var palettes = require('users/gena/packages:palettes'); 8 | 9 | var resultsPath = 10 | 'projects/gee-book/assets/F4-7/Rondonia_example_small'; 11 | var ccdResults = ee.Image(resultsPath); 12 | Map.centerObject(ccdResults, 10); 13 | print(ccdResults); 14 | 15 | // Display segment start and end times. 16 | var start = ccdResults.select('tStart'); 17 | var end = ccdResults.select('tEnd'); 18 | Map.addLayer(start, { 19 | min: 1999, 20 | max: 2001 21 | }, 'Segment start'); 22 | Map.addLayer(end, { 23 | min: 2010, 24 | max: 2020 25 | }, 'Segment end'); 26 | 27 | // Find the segment that intersects a given date. 28 | var targetDate = 2005.5; 29 | var selectSegment = start.lte(targetDate).and(end.gt(targetDate)); 30 | Map.addLayer(selectSegment, {}, 'Identified segment'); 31 | 32 | // Get all coefs in the SWIR1 band. 33 | var SWIR1Coefs = ccdResults.select('SWIR1_coefs'); 34 | Map.addLayer(SWIR1Coefs, {}, 'SWIR1 coefs'); 35 | 36 | // Select only those for the segment that we identified previously. 37 | var sliceStart = selectSegment.arrayArgmax().arrayFlatten([ 38 | ['index'] 39 | ]); 40 | var sliceEnd = sliceStart.add(1); 41 | var selectedCoefs = SWIR1Coefs.arraySlice(0, sliceStart, sliceEnd); 42 | Map.addLayer(selectedCoefs, {}, 'Selected SWIR1 coefs'); 43 | 44 | // Retrieve only the intercept coefficient. 45 | var intercept = selectedCoefs.arraySlice(1, 0, 1).arrayProject([1]); 46 | var intVisParams = { 47 | palette: palettes.matplotlib.viridis[7], 48 | min: -6, 49 | max: 6 50 | }; 51 | Map.addLayer(intercept.arrayFlatten([ 52 | ['INTP'] 53 | ]), intVisParams, 'INTP_SWIR1'); 54 | 55 | // ----------------------------------------------------------------------- 56 | // CHECKPOINT 57 | // ----------------------------------------------------------------------- 58 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.7 Interpreting Time Series with CCDC/F47e-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.7 Interpreting Time Series with CCDC 3 | // Checkpoint: F47e 4 | // Authors: Paulo Arévalo, Pontus Olofsson 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Load the required libraries. 8 | var palettes = require('users/gena/packages:palettes'); 9 | var utils = require( 10 | 'users/parevalo_bu/gee-ccdc-tools:ccdcUtilities/api'); 11 | 12 | // Load the results. 13 | var resultsPath = 14 | 'projects/gee-book/assets/F4-7/Rondonia_example_small'; 15 | var ccdResults = ee.Image(resultsPath); 16 | Map.centerObject(ccdResults, 10); 17 | 18 | // Convert a date into fractional years. 19 | var inputDate = '2005-09-25'; 20 | var dateParams = { 21 | inputFormat: 3, 22 | inputDate: inputDate, 23 | outputFormat: 1 24 | }; 25 | var formattedDate = utils.Dates.convertDate(dateParams); 26 | 27 | // Band names originally used as inputs to the CCD algorithm. 28 | var BANDS = ['BLUE', 'GREEN', 'RED', 'NIR', 'SWIR1', 'SWIR2']; 29 | 30 | // Names for the time segments to retrieve. 31 | var SEGS = ['S1', 'S2', 'S3', 'S4', 'S5', 'S6', 'S7', 'S8', 'S9', 32 | 'S10' 33 | ]; 34 | 35 | // Transform CCD results into a multiband image. 36 | var ccdImage = utils.CCDC.buildCcdImage(ccdResults, SEGS.length, 37 | BANDS); 38 | print(ccdImage); 39 | 40 | // Define bands to select. 41 | var SELECT_BANDS = ['RED', 'GREEN', 'BLUE', 'NIR']; 42 | 43 | // Define coefficients to select. 44 | // This list contains all possible coefficients, and the RMSE 45 | var SELECT_COEFS = ['INTP', 'SLP', 'RMSE']; 46 | 47 | // Obtain coefficients. 48 | var coefs = utils.CCDC.getMultiCoefs( 49 | ccdImage, formattedDate, SELECT_BANDS, SELECT_COEFS, true, 50 | SEGS, 'after'); 51 | print(coefs); 52 | 53 | // Show a single coefficient. 54 | var slpVisParams = { 55 | palette: palettes.matplotlib.viridis[7], 56 | min: -0.0005, 57 | max: 0.005 58 | }; 59 | Map.addLayer(coefs.select('RED_SLP'), slpVisParams, 60 | 'RED SLOPE 2005-09-25'); 61 | 62 | var rmseVisParams = { 63 | palette: palettes.matplotlib.viridis[7], 64 | min: 0, 65 | max: 0.1 66 | }; 67 | Map.addLayer(coefs.select('NIR_RMSE'), rmseVisParams, 68 | 'NIR RMSE 2005-09-25'); 69 | 70 | // Show an RGB with three coefficients. 71 | var rgbVisParams = { 72 | bands: ['RED_INTP', 'GREEN_INTP', 'BLUE_INTP'], 73 | min: 0, 74 | max: 0.1 75 | }; 76 | Map.addLayer(coefs, rgbVisParams, 'RGB 2005-09-25'); 77 | 78 | // ----------------------------------------------------------------------- 79 | // CHECKPOINT 80 | // ----------------------------------------------------------------------- 81 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.8 Data Fusion Merging Classification Streams/F48a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.8 Data Fusion: Merging Classification Streams 3 | // Checkpoint: F48a 4 | // Authors: Jeff Cardille, Rylan Boothman, Mary Villamor, Elijah Perez, 5 | // Eidan Willis, Flavie Pelletier 6 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 | 8 | var events = ee.ImageCollection( 9 | 'projects/gee-book/assets/F4-8/cleanEvents'); 10 | print(events, 'List of Events'); 11 | print('Number of events:', events.size()); 12 | 13 | print(ui.Thumbnail(events, { 14 | min: 0, 15 | max: 3, 16 | palette: ['black', 'green', 'blue', 'yellow'], 17 | framesPerSecond: 1, 18 | dimensions: 1000 19 | })); 20 | 21 | // ----------------------------------------------------------------------- 22 | // CHECKPOINT 23 | // ----------------------------------------------------------------------- 24 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.8 Data Fusion Merging Classification Streams/F48b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.8 Data Fusion: Merging Classification Streams 3 | // Checkpoint: F48b 4 | // Authors: Jeff Cardille, Rylan Boothman, Mary Villamor, Elijah Perez, 5 | // Eidan Willis, Flavie Pelletier 6 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 | 8 | // Access the BULC interface at the following link, 9 | // by copy-pasting the line below into your browser. 10 | // Run the script that loads. 11 | 12 | // https://code.earthengine.google.com/?scriptPath=users%2Falemlakes%2Fr-2909-BULC-Releases%3AInterfaces%2FBULC-Interface%2FCurrent%2FBULC-Interface-Current 13 | 14 | 15 | // ----------------------------------------------------------------------- 16 | // CHECKPOINT 17 | // ----------------------------------------------------------------------- 18 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.8 Data Fusion Merging Classification Streams/F48c-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.8 Data Fusion: Merging Classification Streams 3 | // Checkpoint: F48c 4 | // Authors: Jeff Cardille, Rylan Boothman, Mary Villamor, Elijah Perez, 5 | // Eidan Willis, Flavie Pelletier 6 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 | 8 | // Access the BULC-D interface at the following link, 9 | // by copy-pasting the line below into your browser. 10 | // Run the script that loads. 11 | 12 | // https://code.earthengine.google.com/?scriptPath=users/alemlakes/r-2909-BULC-Releases%3AInterfaces%2FBULC-D-Interface%2FCurrent%2FBULC-D-Interface-Current 13 | 14 | 15 | // ----------------------------------------------------------------------- 16 | // CHECKPOINT 17 | // ----------------------------------------------------------------------- 18 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/F4.8 Data Fusion Merging Classification Streams/F48s1-suplemental.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.8 Data Fusion: Merging Classification Streams 3 | // Checkpoint: F48s1 4 | // Authors: Jeff Cardille, Rylan Boothman, Mary Villamor, Elijah Perez, 5 | // Eidan Willis, Flavie Pelletier 6 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 | 8 | // You can learn more about the operation of BULC at 9 | // the following link: enter it into your browser. 10 | 11 | // https://docs.google.com/spreadsheets/d/1Xo7UllSWFade4_lh9sLc2mqeYwHxJ-JEJGV7mInAILU/edit#gid=0 12 | 13 | // ----------------------------------------------------------------------- 14 | // CHECKPOINT 15 | // ----------------------------------------------------------------------- 16 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | # Part F4: Interpreting Image Series 30 | 31 | One of the paradigm-changing features of Earth Engine is the ability to access decades of imagery without the previous limitation of needing to download all the data to a local disk for processing. Because remote-sensing data files can be enormous, this used to limit many projects to viewing two or three images from different periods. With Earth Engine, users can access tens or hundreds of thousands of images to understand the status of places across decades. 32 | 33 | https://google-earth-engine.com/Interpreting-Image-Series/Filter-Map-Reduce/ 34 | 35 | # Invitation for collaborators: 36 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 37 | 38 | https://google-earth-engine.com/contact/ 39 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F4 - ​Interpreting Image Series/​F4.0 Filter, Map, Reduce/F40a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F4.0 Filter, Map, Reduce 3 | // Checkpoint: F40a 4 | // Author: Jeff Cardille 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | var imgCol = ee.ImageCollection('LANDSAT/LT05/C02/T1_L2'); 8 | // How many Tier 1 Landsat 5 images have ever been collected? 9 | print("All images ever: ", imgCol.size()); // A very large number 10 | 11 | // How many images were collected in the 2000s? 12 | var startDate = '2000-01-01'; 13 | var endDate = '2010-01-01'; 14 | 15 | var imgColfilteredByDate = imgCol.filterDate(startDate, endDate); 16 | print("All images 2000-2010: ", imgColfilteredByDate.size()); 17 | // A smaller (but still large) number 18 | 19 | var ShanghaiImage = ee.Image( 20 | 'LANDSAT/LT05/C02/T1_L2/LT05_118038_20000606'); 21 | Map.centerObject(ShanghaiImage, 9); 22 | 23 | var imgColfilteredByDateHere = imgColfilteredByDate.filterBounds(Map 24 | .getCenter()); 25 | print("All images here, 2000-2010: ", imgColfilteredByDateHere 26 | .size()); // A smaller number 27 | 28 | var L5FilteredLowCloudImages = imgColfilteredByDateHere 29 | .filterMetadata('CLOUD_COVER', 'less_than', 50); 30 | print("Less than 50% clouds in this area, 2000-2010", 31 | L5FilteredLowCloudImages.size()); // A smaller number 32 | 33 | var chainedFilteredSet = imgCol.filterDate(startDate, endDate) 34 | .filterBounds(Map.getCenter()) 35 | .filterMetadata('CLOUD_COVER', 'less_than', 50); 36 | print('Chained: Less than 50% clouds in this area, 2000-2010', 37 | chainedFilteredSet.size()); 38 | 39 | var efficientFilteredSet = imgCol.filterBounds(Map.getCenter()) 40 | .filterDate(startDate, endDate) 41 | .filterMetadata('CLOUD_COVER', 'less_than', 50); 42 | print('Efficient filtering: Less than 50% clouds in this area, 2000-2010', 43 | efficientFilteredSet.size()); 44 | 45 | // ----------------------------------------------------------------------- 46 | // CHECKPOINT 47 | // ----------------------------------------------------------------------- 48 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F5 - ​Vectors and Tables/F5.1 RasterVector Conversions/F51c-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F5.1 Raster/Vector Conversions 3 | // Checkpoint: F51c 4 | // Authors: Keiko Nomura, Samuel Bowers 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | //-------------// 8 | // Section 1.4 // 9 | //-------------// 10 | 11 | // Load required datasets. 12 | var gfc = ee.Image('UMD/hansen/global_forest_change_2020_v1_8'); 13 | var wdpa = ee.FeatureCollection('WCMC/WDPA/current/polygons'); 14 | 15 | // Display deforestation. 16 | var deforestation = gfc.select('lossyear'); 17 | 18 | Map.addLayer(deforestation, { 19 | min: 1, 20 | max: 20, 21 | palette: ['yellow', 'orange', 'red'] 22 | }, 'Deforestation raster'); 23 | 24 | // Select protected areas in the Colombian Amazon. 25 | var amazonianProtectedAreas = [ 26 | 'Cordillera de los Picachos', 'La Paya', 'Nukak', 27 | 'Serrania de Chiribiquete', 28 | 'Sierra de la Macarena', 'Tinigua' 29 | ]; 30 | 31 | var wdpaSubset = wdpa.filter(ee.Filter.inList('NAME', 32 | amazonianProtectedAreas)); 33 | 34 | // Display protected areas as an outline. 35 | var protectedAreasOutline = ee.Image().byte().paint({ 36 | featureCollection: wdpaSubset, 37 | color: 1, 38 | width: 1 39 | }); 40 | 41 | Map.addLayer(protectedAreasOutline, { 42 | palette: 'white' 43 | }, 'Amazonian protected areas'); 44 | 45 | // Set up map display. 46 | Map.centerObject(wdpaSubset); 47 | Map.setOptions('SATELLITE'); 48 | 49 | var scale = deforestation.projection().nominalScale(); 50 | 51 | // Use 'reduceRegions' to sum together pixel areas in each protected area. 52 | wdpaSubset = deforestation.gte(1) 53 | .multiply(ee.Image.pixelArea().divide(10000)).reduceRegions({ 54 | collection: wdpaSubset, 55 | reducer: ee.Reducer.sum().setOutputs([ 56 | 'deforestation_area']), 57 | scale: scale 58 | }); 59 | 60 | print(wdpaSubset); // Note the new 'deforestation_area' property. 61 | 62 | // Normalize by area. 63 | wdpaSubset = wdpaSubset.map( 64 | function(feat) { 65 | return feat.set('deforestation_rate', 66 | ee.Number(feat.get('deforestation_area')) 67 | .divide(feat.area().divide(10000)) // m2 to ha 68 | .divide(20) // number of years 69 | .multiply(100)); // to percentage points 70 | }); 71 | 72 | // Print to identify rates of change per protected area. 73 | // Which has the fastest rate of loss? 74 | print(wdpaSubset.reduceColumns({ 75 | reducer: ee.Reducer.toList().repeat(2), 76 | selectors: ['NAME', 'deforestation_rate'] 77 | })); 78 | 79 | // ----------------------------------------------------------------------- 80 | // CHECKPOINT 81 | // ----------------------------------------------------------------------- 82 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F5 - ​Vectors and Tables/F5.1 RasterVector Conversions/F51d-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F5.1 Raster/Vector Conversions 3 | // Checkpoint: F51d 4 | // Authors: Keiko Nomura, Samuel Bowers 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | //-------------// 8 | // Section 2.1 // 9 | //-------------// 10 | 11 | // Load required datasets. 12 | var gfc = ee.Image('UMD/hansen/global_forest_change_2020_v1_8'); 13 | var wdpa = ee.FeatureCollection('WCMC/WDPA/current/polygons'); 14 | 15 | // Get deforestation. 16 | var deforestation = gfc.select('lossyear'); 17 | 18 | // Generate a new property called 'protected' to apply to the output mask. 19 | var wdpa = wdpa.map(function(feat) { 20 | return feat.set('protected', 1); 21 | }); 22 | 23 | // Rasterize using the new property. 24 | // unmask() sets areas outside protected area polygons to 0. 25 | var wdpaMask = wdpa.reduceToImage(['protected'], ee.Reducer.first()) 26 | .unmask(); 27 | 28 | // Center on Colombia. 29 | Map.setCenter(-75, 3, 6); 30 | 31 | // Display on map. 32 | Map.addLayer(wdpaMask, { 33 | min: 0, 34 | max: 1 35 | }, 'Protected areas (mask)'); 36 | 37 | // Set the deforestation layer to 0 where outside a protected area. 38 | var deforestationProtected = deforestation.where(wdpaMask.eq(0), 0); 39 | 40 | // Update mask to hide where deforestation layer = 0 41 | var deforestationProtected = deforestationProtected 42 | .updateMask(deforestationProtected.gt(0)); 43 | 44 | // Display deforestation in protected areas 45 | Map.addLayer(deforestationProtected, { 46 | min: 1, 47 | max: 20, 48 | palette: ['yellow', 'orange', 'red'] 49 | }, 'Deforestation protected'); 50 | 51 | // Produce an image with unique ID of protected areas. 52 | var wdpaId = wdpa.reduceToImage(['WDPAID'], ee.Reducer.first()); 53 | 54 | Map.addLayer(wdpaId, { 55 | min: 1, 56 | max: 100000 57 | }, 'Protected area ID'); 58 | 59 | // ----------------------------------------------------------------------- 60 | // CHECKPOINT 61 | // ----------------------------------------------------------------------- 62 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F5 - ​Vectors and Tables/F5.1 RasterVector Conversions/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | # Part F5: Vectors and Tables 30 | 31 | 32 | In addition to raster data processing, Earth Engine supports a rich set of vector processing tools. This Part introduces you to the vector framework in Earth Engine, shows you how to create and to import your vector data, and how to combine vector and raster data for analyses. 33 | 34 | # Chapter F5.1: Raster/Vector Conversions 35 | ## Authors 36 | Keiko Nomura, Samuel Bowers 37 | 38 | 39 | 40 | ## Overview 41 | The purpose of this chapter is to review methods of converting between raster and vector data formats, and to understand the circumstances in which this is useful. By way of example, this chapter focuses on topographic elevation and forest cover change in Colombia, but note that these are generic methods that can be applied in a wide variety of situations. 42 | 43 | 44 | ## Learning Outcomes 45 | - Understanding raster and vector data in Earth Engine and their differing properties. 46 | - Knowing how and why to convert from raster to vector. 47 | - Knowing how and why to convert from vector to raster. 48 | - Write a function and map it over a FeatureCollection. 49 | 50 | ## Link for details: 51 | https://google-earth-engine.com/Vectors-and-Tables/Raster-Vector-Conversions/ 52 | 53 | # Invitation for collaborators: 54 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 55 | 56 | https://google-earth-engine.com/contact/ 57 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F5 - ​Vectors and Tables/F5.2 Zonal Statistics/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | # Part F5: Vectors and Tables 30 | 31 | 32 | In addition to raster data processing, Earth Engine supports a rich set of vector processing tools. This Part introduces you to the vector framework in Earth Engine, shows you how to create and to import your vector data, and how to combine vector and raster data for analyses. 33 | 34 | # Chapter F5.2: Zonal Statistics 35 | ## Authors 36 | Sara Winsemius and Justin Braaten 37 | 38 | 39 | 40 | ## Overview 41 | The purpose of this chapter is to extract values from rasters for intersecting points or polygons. We will lay out the process and a function to calculate zonal statistics, which includes optional parameters to modify the function, and then apply the process to three examples using different raster datasets and combinations of parameters. 42 | 43 | 44 | ## Learning Outcomes 45 | - Buffering points as square or circular regions. 46 | - Writing and applying functions with optional parameters. 47 | - Learning what zonal statistics are and how to use reducers. 48 | - Exporting computation results to a table. 49 | - Copying properties from one image to another. 50 | 51 | ## Link for details: 52 | https://google-earth-engine.com/Vectors-and-Tables/Zonal-Statistics/ 53 | 54 | 55 | # Invitation for collaborators: 56 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 57 | 58 | https://google-earth-engine.com/contact/ 59 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F5 - ​Vectors and Tables/F5.3 Advanced Vector Operations/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | # Part F5: Vectors and Tables 30 | 31 | 32 | In addition to raster data processing, Earth Engine supports a rich set of vector processing tools. This Part introduces you to the vector framework in Earth Engine, shows you how to create and to import your vector data, and how to combine vector and raster data for analyses. 33 | 34 | # Chapter F5.3: Advanced Vector Operations 35 | ## Author 36 | Ujaval Gandhi 37 | 38 | 39 | 40 | # Overview 41 | This chapter covers advanced techniques for visualizing and analyzing vector data in Earth Engine. There are many ways to visualize feature collections, and you will learn how to pick the appropriate method to create visualizations, such as a choropleth map. We will also cover geoprocessing techniques involving multiple vector layers, such as selecting features in one layer by their proximity to features in another layer and performing spatial joins. 42 | 43 | 44 | # Learning Outcomes 45 | - Visualizing any vector dataset and creating a thematic map. 46 | - Understanding joins in Earth Engine. 47 | - Carrying out geoprocessing tasks with vector layers in Earth Engine. 48 | 49 | ## Link for details: 50 | https://google-earth-engine.com/Vectors-and-Tables/Advanced-Vector-Operations/ 51 | 52 | 53 | # Invitation for collaborators: 54 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 55 | 56 | https://google-earth-engine.com/contact/ 57 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F5 - ​Vectors and Tables/F5.4 GEEDiT Digitising from satellite imagery/F54a-code.js: -------------------------------------------------------------------------------- 1 | // To access the latest version of GEEDiT (and legacy versions), use the following link: 2 | // https://liverpoolgee.wordpress.com/geedit-geedit-reviewer/ 3 | 4 | // This tutorial was built using GEEDiT v2.02, and should also be valid for any later versions of version 2 that become available in the future. On this page you will see that there are actually two different GEEDiTs for each version. The first accesses Landsat Tier 1 imagery, and the second Landsat Tier 2. The former represent the highest quality imagery with respect to both spectral properties and geolocation accuracy, whereas the latter contains imagery that does not meet Tier 1 criteria. For some regions (e.g., Antarctica and some smaller islands) Tier 2 does provide a greater volume of imagery compared to Tier 1 that may be usable for particular research questions. However, in most cases, you will find that Tier 1 imagery is available. 5 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F5 - ​Vectors and Tables/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | # Part F5: Vectors and Tables 30 | 31 | 32 | In addition to raster data processing, Earth Engine supports a rich set of vector processing tools. This Part introduces you to the vector framework in Earth Engine, shows you how to create and to import your vector data, and how to combine vector and raster data for analyses. 33 | 34 | https://google-earth-engine.com/Vectors-and-Tables/Exploring-Vectors/ 35 | 36 | # Invitation for collaborators: 37 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 38 | 39 | https://google-earth-engine.com/contact/ 40 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F5 - ​Vectors and Tables/​F5.0 Exploring Vectors/F50a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F5.0 Exploring Vectors 3 | // Checkpoint: F50a 4 | // Authors: AJ Purdy, Ellen Brock, David Saah 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // This script contains the Imports, but no code (yet). 8 | 9 | // ----------------------------------------------------------------------- 10 | // CHECKPOINT 11 | // ----------------------------------------------------------------------- 12 | 13 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F5 - ​Vectors and Tables/​F5.0 Exploring Vectors/F50b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F5.0 Exploring Vectors 3 | // Checkpoint: F50b 4 | // Authors: AJ Purdy, Ellen Brock, David Saah 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Import the Census Tiger Boundaries from GEE. 8 | var tiger = ee.FeatureCollection('TIGER/2010/Blocks'); 9 | 10 | // Add the new feature collection to the map, but do not display. 11 | Map.addLayer(tiger, { 12 | 'color': 'black' 13 | }, 'Tiger', false); 14 | 15 | // Assign the feature collection to the variable sfNeighborhoods. 16 | var sfNeighborhoods = ee.FeatureCollection( 17 | 'path/to/your/asset/assetname'); 18 | 19 | // Note: if you are unable to load the feature collection, you 20 | // can access the data by uncommenting out the following two lines: 21 | // var tablePath = 'projects/gee-book/assets/F5-0/SFneighborhoods'; 22 | // var sfNeighborhoods = ee.FeatureCollection(tablePath); 23 | 24 | // Print the size of the feature collection. 25 | // (Answers the question: how many features?) 26 | print(sfNeighborhoods.size()); 27 | Map.addLayer(sfNeighborhoods, { 28 | 'color': 'blue' 29 | }, 'sfNeighborhoods'); 30 | 31 | // ----------------------------------------------------------------------- 32 | // CHECKPOINT 33 | // ----------------------------------------------------------------------- 34 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F5 - ​Vectors and Tables/​F5.0 Exploring Vectors/F50c-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F5.0 Exploring Vectors 3 | // Checkpoint: F50c 4 | // Authors: AJ Purdy, Ellen Brock, David Saah 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Import the Census Tiger Boundaries from GEE. 8 | var tiger = ee.FeatureCollection('TIGER/2010/Blocks'); 9 | 10 | // Add the new feature collection to the map, but do not display. 11 | Map.addLayer(tiger, { 12 | 'color': 'black' 13 | }, 'Tiger', false); 14 | 15 | // Assign the feature collection to the variable sfNeighborhoods. 16 | var sfNeighborhoods = ee.FeatureCollection( 17 | 'path/to/your/asset/assetname'); 18 | 19 | // Note: if you are unable to load the feature collection, you 20 | // can access the data by uncommenting out the following two lines: 21 | // var tablePath = 'projects/gee-book/assets/F5-0/SFneighborhoods'; 22 | // var sfNeighborhoods = ee.FeatureCollection(tablePath); 23 | 24 | 25 | 26 | // Print the size of the feature collection. 27 | // (Answers the question: how many features?) 28 | print(sfNeighborhoods.size()); 29 | Map.addLayer(sfNeighborhoods, { 30 | 'color': 'blue' 31 | }, 'sfNeighborhoods'); 32 | 33 | // ----------------------------------------------------------------------- 34 | // CHECKPOINT 35 | // ----------------------------------------------------------------------- 36 | 37 | // Filter sfNeighborhoods by USF. 38 | var usfNeighborhood = sfNeighborhoods.filterBounds(usf_point); 39 | 40 | // Filter the Census blocks by the boundary of the neighborhood layer. 41 | var usfTiger = tiger.filterBounds(usfNeighborhood); 42 | Map.addLayer(usfTiger, {}, 'usf_Tiger'); 43 | 44 | print(usfTiger); 45 | 46 | // Filter for census blocks by housing units 47 | var housing10_l250 = usfTiger 48 | .filter(ee.Filter.lt('housing10', 250)); 49 | 50 | var housing10_g50_l250 = housing10_l250.filter(ee.Filter.gt( 51 | 'housing10', 50)); 52 | 53 | Map.addLayer(housing10_g50_l250, { 54 | 'color': 'Magenta' 55 | }, 'housing'); 56 | 57 | var housing_area = housing10_g50_l250.geometry().area(); 58 | print('housing_area:', housing_area); 59 | 60 | var housing10_mean = usfTiger.reduceColumns({ 61 | reducer: ee.Reducer.mean(), 62 | selectors: ['housing10'] 63 | }); 64 | 65 | print('housing10_mean', housing10_mean); 66 | 67 | // ----------------------------------------------------------------------- 68 | // CHECKPOINT 69 | // ----------------------------------------------------------------------- 70 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/F6.1 Collaborating in Earth Engine with Scripts and Assets/F61a-code.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishnakafle/gee-tutorials/d63ff3a676334821fb76c7964a3aebd9faa2d39f/Part F - Fundamentals/F6 - ​Advanced Topics/F6.1 Collaborating in Earth Engine with Scripts and Assets/F61a-code.js -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/F6.2 Scaling up in Earth Engine/F63c-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.2 Scaling Up in Earth Engine 3 | // Checkpoint: F62c 4 | // Authors: Jillian M. Deines, Stefania Di Tommaso, Nicholas Clinton, Noel Gorelick 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Set the Region of Interest:Seattle, Washington, United States 8 | var roi = ee.Geometry.Point([-122.33524518034544, 47.61356183942883]); 9 | 10 | // Dates over which to create a median composite. 11 | var start = ee.Date('2019-03-01'); 12 | var end = ee.Date('2019-09-01'); 13 | 14 | // Specify module with cloud mask functions. 15 | var s2mask_tools = require( 16 | 'projects/gee-edu/book:Part F - Fundamentals/F6 - Advanced Topics/F6.2 Scaling Up/modules/s2cloudmask.js' 17 | ); 18 | 19 | 20 | // Specify S2 collections and filter. 21 | 22 | // Sentinel-2 surface reflectance data for the composite. 23 | var s2Sr = ee.ImageCollection('COPERNICUS/S2_SR') 24 | .filterDate(start, end) 25 | .filterBounds(roi) 26 | .select(['B2', 'B3', 'B4', 'B5']); 27 | 28 | // Sentinel-2 Level 1C data (top-of-atmosphere). 29 | // Bands B7, B8, B8A and B10 needed for CDI and the cloud mask function. 30 | var s2 = ee.ImageCollection('COPERNICUS/S2') 31 | .filterBounds(roi) 32 | .filterDate(start, end) 33 | .select(['B7', 'B8', 'B8A', 'B10']); 34 | 35 | // Cloud probability dataset - used in cloud mask function 36 | var s2c = ee.ImageCollection('COPERNICUS/S2_CLOUD_PROBABILITY') 37 | .filterDate(start, end) 38 | .filterBounds(roi); 39 | 40 | // Apply the cloud mask. 41 | 42 | // Join the cloud probability dataset to surface reflectance. 43 | var withCloudProbability = s2mask_tools.indexJoin(s2Sr, s2c, 44 | 'cloud_probability'); 45 | 46 | // Join the L1C data to get the bands needed for CDI. 47 | var withS2L1C = s2mask_tools.indexJoin(withCloudProbability, s2, 48 | 'l1c'); 49 | 50 | // Map the cloud masking function over the joined collection. 51 | // Cast output to ImageCollection 52 | var masked = ee.ImageCollection(withS2L1C.map(s2mask_tools 53 | .maskImage)); 54 | 55 | // Take the median, specifying a tileScale to avoid memory errors. 56 | var median = masked.reduce(ee.Reducer.median(), 8); 57 | 58 | // Display the results. 59 | Map.centerObject(roi, 12); 60 | Map.addLayer(roi); 61 | 62 | var viz = { 63 | bands: ['B4_median', 'B3_median', 'B2_median'], 64 | min: 0, 65 | max: 3000 66 | }; 67 | Map.addLayer(median, viz, 'median'); 68 | 69 | Map.centerObject(roi, 9); 70 | Map.addLayer(roi); 71 | Map.addLayer(median, viz, 'median'); 72 | 73 | // ----------------------------------------------------------------------- 74 | // CHECKPOINT 75 | // ----------------------------------------------------------------------- 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/F6.2 Scaling up in Earth Engine/F63e-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.2 Scaling Up in Earth Engine 3 | // Checkpoint: F62e 4 | // Authors: Jillian M. Deines, Stefania Di Tommaso, Nicholas Clinton, Noel Gorelick 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // load image collection and mosaic into single image 8 | var assetCollection = 'projects/gee-book/assets/F6-2/s2_composite_WA'; 9 | var composite = ee.ImageCollection(assetCollection).mosaic(); 10 | 11 | // Display the results 12 | var geometry = ee.Geometry.Point([-120.5873563817392, 13 | 47.39035206888694 14 | ]); 15 | Map.centerObject(geometry, 6); 16 | var vizParams = { 17 | bands: ['B4_median', 'B3_median', 'B2_median'], 18 | min: 0, 19 | max: 3000 20 | }; 21 | Map.addLayer(composite, vizParams, 'median'); 22 | 23 | // ----------------------------------------------------------------------- 24 | // CHECKPOINT 25 | // ----------------------------------------------------------------------- 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/F6.2 Scaling up in Earth Engine/modules/s2cloudmask.js: -------------------------------------------------------------------------------- 1 | // Functions for implementing a Sentinel II cloud mask. 2 | 3 | // Join two collections on their 'system:index' property. 4 | // The propertyName parameter is the name of the property 5 | // that references the joined image. 6 | function indexJoin(collectionA, collectionB, propertyName) { 7 | var joined = ee.ImageCollection(ee.Join.saveFirst(propertyName).apply({ 8 | primary: collectionA, 9 | secondary: collectionB, 10 | condition: ee.Filter.equals({ 11 | leftField: 'system:index', 12 | rightField: 'system:index'}) 13 | })); 14 | // Merge the bands of the joined image. 15 | return joined.map(function(image) { 16 | return image.addBands(ee.Image(image.get(propertyName))); 17 | }); 18 | } 19 | 20 | // Aggressively mask clouds and shadows. 21 | function maskImage(image) { 22 | // Compute the cloud displacement index from the L1C bands. 23 | var cdi = ee.Algorithms.Sentinel2.CDI(image); 24 | var s2c = image.select('probability'); 25 | var cirrus = image.select('B10').multiply(0.0001); 26 | 27 | // Assume low-to-mid atmospheric clouds to be pixels where probability 28 | // is greater than 65%, and CDI is less than -0.5. For higher atmosphere 29 | // cirrus clouds, assume the cirrus band is greater than 0.01. 30 | // The final cloud mask is one or both of these conditions. 31 | var isCloud = s2c.gt(65).and(cdi.lt(-0.5)).or(cirrus.gt(0.01)); 32 | 33 | // Reproject is required to perform spatial operations at 20m scale. 34 | // 20m scale is for speed, and assumes clouds don't require 10m precision. 35 | isCloud = isCloud.focal_min(3).focal_max(16); 36 | isCloud = isCloud.reproject({crs: cdi.projection(), scale: 20}); 37 | 38 | // Project shadows from clouds we found in the last step. This assumes we're working in 39 | // a UTM projection. 40 | var shadowAzimuth = ee.Number(90) 41 | .subtract(ee.Number(image.get('MEAN_SOLAR_AZIMUTH_ANGLE'))); 42 | 43 | // With the following reproject, the shadows are projected 5km. 44 | isCloud = isCloud.directionalDistanceTransform(shadowAzimuth, 50); 45 | isCloud = isCloud.reproject({crs: cdi.projection(), scale: 100}); 46 | 47 | isCloud = isCloud.select('distance').mask(); 48 | return image.select('B2', 'B3', 'B4').updateMask(isCloud.not()); 49 | } 50 | 51 | exports.maskImage = maskImage; 52 | exports.indexJoin = indexJoin; 53 | 54 | // LGTM (nclinton) -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/F6.3 Sharing Work in Earth Engine Basic UI and Apps/F63b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.3 Sharing Work in Earth Engine: Basic UI and Apps 3 | // Checkpoint: F63b 4 | // Author: Qiusheng Wu 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | 8 | // Follow the steps below to set up a conda environment and install geemap. More information about the geemap installation can be found at https://geemap.org/installation. 9 | 10 | // First, you need to download and install Miniconda or Anaconda on your computer. After installation, open the Anaconda Prompt. If you are using Windows, go to Start Menu > Anaconda3 > Anaconda Prompt. If you are using macOS or Linux, open the Terminal. Enter the following commands into the Anaconda Prompt or Terminal and follow the on-screen instructions to create a conda environment and install geemap. 11 | 12 | // conda create -n gee python=3.9 13 | // conda activate gee 14 | // conda install mamba -c conda-forge 15 | // mamba install geemap voila -c conda-forge 16 | 17 | 18 | // Note that mamba is a reimplementation of the conda package manager in C++. It enables the parallel downloading of repository data and package files using multithreading and usually resolves dependencies much faster than conda. Once geemap has been installed successfully, enter the following commands into the Terminal and press Enter to launch a Jupyter notebook in your browser. 19 | 20 | // conda activate gee 21 | // jupyter notebook 22 | 23 | 24 | 25 | 26 | // ----------------------------------------------------------------------- 27 | // CHECKPOINT 28 | // ----------------------------------------------------------------------- 29 | 30 | 31 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/F6.3 Sharing Work in Earth Engine Basic UI and Apps/F63c-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.3 Sharing Work in Earth Engine: Basic UI and Apps 3 | // Checkpoint: F63c 4 | // Author: Qiusheng Wu 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | 8 | // Enter the link below into your browser to see how your code should look at this point 9 | 10 | // https://geemap.org/notebooks/nlcd_app 11 | 12 | 13 | 14 | 15 | // ----------------------------------------------------------------------- 16 | // CHECKPOINT 17 | // ----------------------------------------------------------------------- 18 | 19 | 20 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/F6.3 Sharing Work in Earth Engine Basic UI and Apps/F63d-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.3 Sharing Work in Earth Engine: Basic UI and Apps 3 | // Checkpoint: F63d 4 | // Author: Qiusheng Wu 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | 8 | // Enter the link below into your browser to see how your code should look at this point 9 | 10 | // https://github.com/giswqs/earthengine-apps 11 | 12 | 13 | // Note from Ellen below: "Congratulations! You have successfully deployed the Earth Engine App on Heroku. " 14 | // Does not work although I followed the instructions :). https://docs.google.com/document/d/197jvxxajqEfCHbuw_2EcxHAv83Pjka36/edit?usp=sharing&ouid=101065852418423274055&rtpof=true&sd=true 15 | // Author will have to test. I can test it if desired. Others are also welcome to test this. 16 | // Was tested and closed by author in beginning of March. Feel bad that is happening right now. 17 | // @jeffcardille@gmail.com 18 | // Show less 19 | // Hi, I am also tagging Quisheng @qwu18@utk.edu here. Perhaps this got missed due to the editing comments. Hi Qiusheng, I ran into an issue here. Can you please check once more please? Thanks. 20 | 21 | 22 | // ----------------------------------------------------------------------- 23 | // CHECKPOINT 24 | // ----------------------------------------------------------------------- 25 | 26 | 27 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/F6.4 Combining R and Earth Engine/F64b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.4 Combining R and Earth Engine 3 | // Checkpoint: F64b 4 | // Authors: Cesar Aybar, David Montero, Antony Barja, Fernando Herrera, Andrea Gonzales, and Wendy Espinoza 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Enter the link below into your browser to see how your code should look at this point 8 | 9 | // https://github.com/csaybar/rgee_examples/blob/main/script01.R 10 | 11 | 12 | 13 | 14 | // ----------------------------------------------------------------------- 15 | // CHECKPOINT 16 | // ----------------------------------------------------------------------- 17 | 18 | 19 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/F6.4 Combining R and Earth Engine/F64c-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.4 Combining R and Earth Engine 3 | // Checkpoint: F64c 4 | // Authors: Cesar Aybar, David Montero, Antony Barja, Fernando Herrera, Andrea Gonzales, and Wendy Espinoza 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Enter the link below into your browser to see how your code should look at this point 8 | 9 | // https://github.com/csaybar/rgee_examples/blob/main/script02.R 10 | 11 | 12 | 13 | 14 | // ----------------------------------------------------------------------- 15 | // CHECKPOINT 16 | // ----------------------------------------------------------------------- 17 | 18 | 19 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/F6.4 Combining R and Earth Engine/F64d-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.4 Combining R and Earth Engine 3 | // Checkpoint: F64d 4 | // Authors: Cesar Aybar, David Montero, Antony Barja, Fernando Herrera, Andrea Gonzales, and Wendy Espinoza 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Enter the link below into your browser to see how your code should look at this point 8 | 9 | // https://github.com/csaybar/rgee_examples/blob/main/script03.R 10 | 11 | 12 | 13 | 14 | // ----------------------------------------------------------------------- 15 | // CHECKPOINT 16 | // ----------------------------------------------------------------------- 17 | 18 | 19 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/F6.4 Combining R and Earth Engine/F64e-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.4 Combining R and Earth Engine 3 | // Checkpoint: F64e 4 | // Authors: Cesar Aybar, David Montero, Antony Barja, Fernando Herrera, Andrea Gonzales, and Wendy Espinoza 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Enter the link below into your browser to see how your code should look at this point 8 | 9 | // https://github.com/csaybar/rgee_examples/blob/main/script04.R 10 | 11 | 12 | 13 | 14 | // ----------------------------------------------------------------------- 15 | // CHECKPOINT 16 | // ----------------------------------------------------------------------- 17 | 18 | 19 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/F6.4 Combining R and Earth Engine/F64f-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.4 Combining R and Earth Engine 3 | // Checkpoint: F64f 4 | // Authors: Cesar Aybar, David Montero, Antony Barja, Fernando Herrera, Andrea Gonzales, and Wendy Espinoza 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | var LandsatLST = require( 8 | 'users/sofiaermida/landsat_smw_lst:modules/Landsat_LST.js'); 9 | 10 | var geometry = ee.Geometry.Rectangle([-8.91, 40.0, -8.3, 40.4]); 11 | var satellite = 'L8'; 12 | var date_start = '2018-05-15'; 13 | var date_end = '2018-05-31'; 14 | var use_ndvi = true; 15 | 16 | var LandsatColl = LandsatLST.collection(satellite, date_start, 17 | date_end, geometry, use_ndvi); 18 | 19 | var exImage = LandsatColl.first(); 20 | 21 | var cmap = ['blue', 'cyan', 'green', 'yellow', 'red']; 22 | 23 | Map.centerObject(geometry); 24 | 25 | Map.addLayer(exImage.select('LST'), { 26 | min: 290, 27 | max: 320, 28 | palette: cmap 29 | }, 'LST') 30 | 31 | 32 | 33 | 34 | // ----------------------------------------------------------------------- 35 | // CHECKPOINT 36 | // ----------------------------------------------------------------------- 37 | 38 | 39 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/F6.4 Combining R and Earth Engine/F64g-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.4 Combining R and Earth Engine 3 | // Checkpoint: F64g 4 | // Authors: Cesar Aybar, David Montero, Antony Barja, Fernando Herrera, Andrea Gonzales, and Wendy Espinoza 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Enter the link below into your browser to see how your code should look at this point 8 | 9 | // https://github.com/csaybar/rgee_examples/blob/main/script05.R 10 | 11 | 12 | 13 | 14 | // ----------------------------------------------------------------------- 15 | // CHECKPOINT 16 | // ----------------------------------------------------------------------- 17 | 18 | 19 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | 30 | # Part F6: Advanced Topics 31 | 32 | Although you now know the most basic fundamentals of Earth Engine, there is still much more that can be done. The Part presents some advanced topics that can help expand your skill set for doing larger and more complex projects. These include tools for sharing code among users, scaling up with efficient project design, creating apps for non-expert users, and combining R with other information processing platforms. 33 | 34 | https://google-earth-engine.com/Advanced-Topics/Advanced-Raster-Visualization/ 35 | 36 | 37 | # Invitation for collaborators: 38 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 39 | 40 | https://google-earth-engine.com/contact/ 41 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/​​F6.0 Advanced Raster Visualization/F60a-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.0 Advanced Raster Visualization 3 | // Checkpoint: F60a 4 | // Authors: Gennadii Donchyts, Fedor Baart 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Load the ERA5 reanalysis monthly means. 8 | var era5 = ee.ImageCollection('ECMWF/ERA5_LAND/MONTHLY'); 9 | 10 | // Load the palettes package. 11 | var palettes = require('users/gena/packages:palettes'); 12 | 13 | // Select temperature near ground. 14 | era5 = era5.select('temperature_2m'); 15 | 16 | // Choose a diverging colormap for anomalies. 17 | var balancePalette = palettes.cmocean.Balance[7]; 18 | var threeColorPalette = ['blue', 'white', 'red']; 19 | 20 | // Show the palette in the Inspector window. 21 | palettes.showPalette('temperature anomaly', balancePalette); 22 | palettes.showPalette('temperature anomaly', threeColorPalette); 23 | 24 | // Select 2 time windows of 10 years. 25 | var era5_1980 = era5.filterDate('1981-01-01', '1991-01-01').mean(); 26 | var era5_2010 = era5.filterDate('2011-01-01', '2020-01-01').mean(); 27 | 28 | // Compute the temperature change. 29 | var era5_diff = era5_2010.subtract(era5_1980); 30 | 31 | // Show it on the map. 32 | Map.addLayer(era5_diff, { 33 | palette: threeColorPalette, 34 | min: -2, 35 | max: 2 36 | }, 'Blue White Red palette'); 37 | 38 | Map.addLayer(era5_diff, { 39 | palette: balancePalette, 40 | min: -2, 41 | max: 2 42 | }, 'Balance palette'); 43 | 44 | // ----------------------------------------------------------------------- 45 | // CHECKPOINT 46 | // ----------------------------------------------------------------------- 47 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/​​F6.0 Advanced Raster Visualization/F60b-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.0 Advanced Raster Visualization 3 | // Checkpoint: F60b 4 | // Authors: Gennadii Donchyts, Fedor Baart 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // An image of the Thwaites glacier. 8 | var imageId = 9 | 'COPERNICUS/S1_GRD/S1B_EW_GRDM_1SSH_20211216T041925_20211216T042029_030045_03965B_AF0A'; 10 | 11 | // Look it up and select the HH band. 12 | var img = ee.Image(imageId).select('HH'); 13 | 14 | // Use the palette library. 15 | var palettes = require('users/gena/packages:palettes'); 16 | 17 | // Access the ice palette. 18 | var icePalette = palettes.cmocean.Ice[7]; 19 | 20 | // Show it in the console. 21 | palettes.showPalette('Ice', icePalette); 22 | 23 | // Use it to visualize the radar data. 24 | Map.addLayer(img, { 25 | palette: icePalette, 26 | min: -15, 27 | max: 1 28 | }, 'Sentinel-1 radar'); 29 | 30 | // Zoom to the grounding line of the Thwaites Glacier. 31 | Map.centerObject(ee.Geometry.Point([-105.45882094907664, - 32 | 74.90419580705336 33 | ]), 8); 34 | 35 | // ----------------------------------------------------------------------- 36 | // CHECKPOINT 37 | // ----------------------------------------------------------------------- 38 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/​​F6.0 Advanced Raster Visualization/F60c-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.0 Advanced Raster Visualization 3 | // Checkpoint: F60c 4 | // Authors: Gennadii Donchyts, Fedor Baart 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Advanced remapping using NLCD. 8 | // Import NLCD. 9 | var nlcd = ee.ImageCollection('USGS/NLCD_RELEASES/2016_REL'); 10 | 11 | // Use Filter to select the 2016 dataset. 12 | var nlcd2016 = nlcd.filter(ee.Filter.eq('system:index', '2016')) 13 | .first(); 14 | 15 | // Select the land cover band. 16 | var landcover = nlcd2016.select('landcover'); 17 | 18 | // Map the NLCD land cover. 19 | Map.addLayer(landcover, null, 'NLCD Landcover'); 20 | 21 | 22 | // Now suppose we want to change the color palette. 23 | var newPalette = ['466b9f', 'd1def8', 'dec5c5', 24 | 'ab0000', 'ab0000', 'ab0000', 25 | 'b3ac9f', '68ab5f', '1c5f2c', 26 | 'b5c58f', 'af963c', 'ccb879', 27 | 'dfdfc2', 'd1d182', 'a3cc51', 28 | '82ba9e', 'dcd939', 'ab6c28', 29 | 'b8d9eb', '6c9fb8' 30 | ]; 31 | 32 | // Try mapping with the new color palette. 33 | Map.addLayer(landcover, { 34 | palette: newPalette 35 | }, 'NLCD New Palette'); 36 | 37 | // Extract the class values and save them as a list. 38 | var values = ee.List(landcover.get('landcover_class_values')); 39 | 40 | // Print the class values to console. 41 | print('raw class values', values); 42 | 43 | // Determine the maximum index value 44 | var maxIndex = values.size().subtract(1); 45 | 46 | // Create a new index for the remap 47 | var indexes = ee.List.sequence(0, maxIndex); 48 | 49 | // Print the updated class values to console. 50 | print('updated class values', indexes); 51 | 52 | // Remap NLCD and display it in the map. 53 | var colorized = landcover.remap(values, indexes) 54 | .visualize({ 55 | min: 0, 56 | max: maxIndex, 57 | palette: newPalette 58 | }); 59 | Map.addLayer(colorized, {}, 'NLCD Remapped Colors'); 60 | 61 | // ----------------------------------------------------------------------- 62 | // CHECKPOINT 63 | // ----------------------------------------------------------------------- 64 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/​​F6.0 Advanced Raster Visualization/F60d-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.0 Advanced Raster Visualization 3 | // Checkpoint: F60d 4 | // Authors: Gennadii Donchyts, Fedor Baart 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | /** 8 | * Draws a string as a raster image at a given point. 9 | * 10 | * @param {string} str - string to draw 11 | * @param {ee.Geometry} point - location the the string will be drawn 12 | * @param {{string, Object}} options - optional properties used to style text 13 | * 14 | * The options dictionary may include one or more of the following: 15 | * fontSize - 16|18|24|32 - the size of the font (default: 16) 16 | * fontType - Arial|Consolas - the type of the font (default: Arial) 17 | * alignX - left|center|right (default: left) 18 | * alignY - top|center|bottom (default: top) 19 | * textColor - text color string (default: ffffff - white) 20 | * textOpacity - 0-1, opacity of the text (default: 0.9) 21 | * textWidth - width of the text (default: 1) 22 | * outlineColor - text outline color string (default: 000000 - black) 23 | * outlineOpacity - 0-1, opacity of the text outline (default: 0.4) 24 | * outlineWidth - width of the text outlines (default: 0) 25 | */ 26 | 27 | // Include the text package. 28 | var text = require('users/gena/packages:text'); 29 | 30 | // Configure map (change center and map type). 31 | Map.setCenter(0, 0, 10); 32 | Map.setOptions('HYBRID'); 33 | 34 | // Draw text string and add to map. 35 | var pt = Map.getCenter(); 36 | var scale = Map.getScale(); 37 | var image = text.draw('Hello World!', pt, scale); 38 | Map.addLayer(image); 39 | 40 | // ----------------------------------------------------------------------- 41 | // CHECKPOINT 42 | // ----------------------------------------------------------------------- 43 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/​​F6.0 Advanced Raster Visualization/F60e-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.0 Advanced Raster Visualization 3 | // Checkpoint: F60e 4 | // Authors: Gennadii Donchyts, Fedor Baart 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | /** 8 | * Draws a string as a raster image at a given point. 9 | * 10 | * @param {string} str - string to draw 11 | * @param {ee.Geometry} point - location the the string will be drawn 12 | * @param {{string, Object}} options - optional properties used to style text 13 | * 14 | * The options dictionary may include one or more of the following: 15 | * fontSize - 16|18|24|32 - the size of the font (default: 16) 16 | * fontType - Arial|Consolas - the type of the font (default: Arial) 17 | * alignX - left|center|right (default: left) 18 | * alignY - top|center|bottom (default: top) 19 | * textColor - text color string (default: ffffff - white) 20 | * textOpacity - 0-1, opacity of the text (default: 0.9) 21 | * textWidth - width of the text (default: 1) 22 | * outlineColor - text outline color string (default: 000000 - black) 23 | * outlineOpacity - 0-1, opacity of the text outline (default: 0.4) 24 | * outlineWidth - width of the text outlines (default: 0) 25 | */ 26 | 27 | // Include the text package. 28 | var text = require('users/gena/packages:text'); 29 | 30 | // Configure map (change center and map type). 31 | Map.setCenter(0, 0, 10); 32 | Map.setOptions('HYBRID'); 33 | 34 | // Draw text string and add to map. 35 | var pt = Map.getCenter(); 36 | var scale = Map.getScale(); 37 | var image = text.draw('Hello World!', pt, scale); 38 | 39 | // ----------------------------------------------------------------------- 40 | // CHECKPOINT 41 | // ----------------------------------------------------------------------- 42 | 43 | var image = text.draw('Hello World!', pt, scale, { 44 | fontSize: 32, 45 | fontType: 'Consolas', 46 | textColor: 'black', 47 | outlineColor: 'white', 48 | outlineWidth: 1, 49 | outlineOpacity: 0.8 50 | }); 51 | 52 | // Add the text image to the map. 53 | Map.addLayer(image); 54 | 55 | // ----------------------------------------------------------------------- 56 | // CHECKPOINT 57 | // ----------------------------------------------------------------------- 58 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/​​F6.0 Advanced Raster Visualization/F60f-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.0 Advanced Raster Visualization 3 | // Checkpoint: F60f 4 | // Authors: Gennadii Donchyts, Fedor Baart 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | var text = require('users/gena/packages:text'); 8 | 9 | var geometry = ee.Geometry.Polygon( 10 | [ 11 | [ 12 | [-109.248, 43.3913], 13 | [-109.248, 33.2689], 14 | [-86.5283, 33.2689], 15 | [-86.5283, 43.3913] 16 | ] 17 | ], null, false); 18 | 19 | Map.centerObject(geometry, 6); 20 | 21 | function annotate(image) { 22 | // Annotates an image by adding outline border and cloudiness 23 | // Cloudiness is shown as a text string rendered at the image center. 24 | 25 | // Add an edge around the image. 26 | var edge = ee.FeatureCollection([image]) 27 | .style({ 28 | color: 'cccc00cc', 29 | fillColor: '00000000' 30 | }); 31 | 32 | // Draw cloudiness as text. 33 | var props = { 34 | textColor: '0000aa', 35 | outlineColor: 'ffffff', 36 | outlineWidth: 2, 37 | outlineOpacity: 0.6, 38 | fontSize: 24, 39 | fontType: 'Consolas' 40 | }; 41 | var center = image.geometry().centroid(1); 42 | var str = ee.Number(image.get('CLOUD_COVER')).format('%.2f'); 43 | var scale = Map.getScale(); 44 | var textCloudiness = text.draw(str, center, scale, props); 45 | 46 | // Shift left 25 pixels. 47 | textCloudiness = textCloudiness 48 | .translate(-scale * 25, 0, 'meters', 'EPSG:3857'); 49 | 50 | // Merge results. 51 | return ee.ImageCollection([edge, textCloudiness]).mosaic(); 52 | } 53 | 54 | // Select images. 55 | var images = ee.ImageCollection('LANDSAT/LC08/C02/T1_RT_TOA') 56 | .select([5, 4, 2]) 57 | .filterBounds(geometry) 58 | .filterDate('2018-01-01', '2018-01-7'); 59 | 60 | // dim background. 61 | Map.addLayer(ee.Image(1), { 62 | palette: ['black'] 63 | }, 'black', true, 0.5); 64 | 65 | // Show images. 66 | Map.addLayer(images, { 67 | min: 0.05, 68 | max: 1, 69 | gamma: 1.4 70 | }, 'images'); 71 | 72 | // Show annotations. 73 | var labels = images.map(annotate); 74 | var labelsLayer = ui.Map.Layer(labels, {}, 'annotations'); 75 | Map.layers().add(labelsLayer); 76 | 77 | // re-render (rescale) annotations when map zoom changes. 78 | Map.onChangeZoom(function(zoom) { 79 | labelsLayer.setEeObject(images.map(annotate)); 80 | }); 81 | 82 | // ----------------------------------------------------------------------- 83 | // CHECKPOINT 84 | // ----------------------------------------------------------------------- 85 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/​​F6.0 Advanced Raster Visualization/F60g-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.0 Advanced Raster Visualization 3 | // Checkpoint: F60g 4 | // Authors: Gennadii Donchyts, Fedor Baart 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Include packages. 8 | var palettes = require('users/gena/packages:palettes'); 9 | var text = require('users/gena/packages:text'); 10 | 11 | var point = /* color: #98ff00 */ ee.Geometry.Point([- 12 | 106.15944300895228, -74.58262940096245 13 | ]); 14 | 15 | var rect = /* color: #d63000 */ 16 | ee.Geometry.Polygon( 17 | [ 18 | [ 19 | [-106.19789515738981, -74.56509549360152], 20 | [-106.19789515738981, -74.78071448733921], 21 | [-104.98115931754606, -74.78071448733921], 22 | [-104.98115931754606, -74.56509549360152] 23 | ] 24 | ], null, false); 25 | 26 | // Lookup the ice palette. 27 | var palette = palettes.cmocean.Ice[7]; 28 | 29 | // Show it in the console. 30 | palettes.showPalette('Ice', palette); 31 | 32 | // Center map on geometry. 33 | Map.centerObject(point, 9); 34 | 35 | // Select S1 images for the Thwaites glacier. 36 | var images = ee.ImageCollection('COPERNICUS/S1_GRD') 37 | .filterBounds(rect) 38 | .filterDate('2021-01-01', '2021-03-01') 39 | .select('HH') 40 | // Make sure we include only images which fully contain the region geometry. 41 | .filter(ee.Filter.isContained({ 42 | leftValue: rect, 43 | rightField: '.geo' 44 | })) 45 | .sort('system:time_start'); 46 | 47 | // Print number of images. 48 | print(images.size()); 49 | 50 | // ----------------------------------------------------------------------- 51 | // CHECKPOINT 52 | // ----------------------------------------------------------------------- 53 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/​​F6.0 Advanced Raster Visualization/F60h-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.0 Advanced Raster Visualization 3 | // Checkpoint: F60h 4 | // Authors: Gennadii Donchyts, Fedor Baart 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | // Include packages. 8 | var palettes = require('users/gena/packages:palettes'); 9 | var text = require('users/gena/packages:text'); 10 | 11 | var point = /* color: #98ff00 */ ee.Geometry.Point([- 12 | 106.15944300895228, -74.58262940096245 13 | ]); 14 | 15 | var rect = /* color: #d63000 */ 16 | ee.Geometry.Polygon( 17 | [ 18 | [ 19 | [-106.19789515738981, -74.56509549360152], 20 | [-106.19789515738981, -74.78071448733921], 21 | [-104.98115931754606, -74.78071448733921], 22 | [-104.98115931754606, -74.56509549360152] 23 | ] 24 | ], null, false); 25 | 26 | // Lookup the ice palette. 27 | var palette = palettes.cmocean.Ice[7]; 28 | 29 | // Show it in the console. 30 | palettes.showPalette('Ice', palette); 31 | 32 | // Center map on geometry. 33 | Map.centerObject(point, 9); 34 | 35 | // Select S1 images for the Thwaites glacier. 36 | var images = ee.ImageCollection('COPERNICUS/S1_GRD') 37 | .filterBounds(rect) 38 | .filterDate('2021-01-01', '2021-03-01') 39 | .select('HH') 40 | // Make sure we include only images which fully contain the region geometry. 41 | .filter(ee.Filter.isContained({ 42 | leftValue: rect, 43 | rightField: '.geo' 44 | })) 45 | .sort('system:time_start'); 46 | 47 | // Print number of images. 48 | print(images.size()); 49 | 50 | // ----------------------------------------------------------------------- 51 | // CHECKPOINT 52 | // ----------------------------------------------------------------------- 53 | 54 | // Render images. 55 | var vis = { 56 | palette: palette, 57 | min: -15, 58 | max: 1 59 | }; 60 | 61 | var scale = Map.getScale(); 62 | var textProperties = { 63 | outlineColor: '000000', 64 | outlineWidth: 3, 65 | outlineOpacity: 0.6 66 | }; 67 | 68 | var imagesRgb = images.map(function(i) { 69 | // Use the date as the label. 70 | var label = i.date().format('YYYY-MM-dd'); 71 | var labelImage = text.draw(label, point, scale, 72 | textProperties); 73 | 74 | return i.visualize(vis) 75 | .blend(labelImage) // Blend label image on top. 76 | .set({ 77 | label: label 78 | }); // Keep the text property. 79 | }); 80 | Map.addLayer(imagesRgb.first()); 81 | Map.addLayer(rect, {color:'blue'}, 'rect', 1, 0.5); 82 | 83 | // ----------------------------------------------------------------------- 84 | // CHECKPOINT 85 | // ----------------------------------------------------------------------- 86 | -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/​​F6.0 Advanced Raster Visualization/F60j-code.js: -------------------------------------------------------------------------------- 1 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | // Chapter: F6.0 Advanced Raster Visualization 3 | // Checkpoint: F60j 4 | // Authors: Gennadii Donchyts, Fedor Baart 5 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | 7 | var dem = ee.Image('AHN/AHN2_05M_RUW'); 8 | 9 | // Change map style to HYBRID and center map on the Netherlands 10 | Map.setOptions('HYBRID'); 11 | Map.setCenter(4.4082, 52.1775, 18); 12 | 13 | // Visualize DEM using black-white color palette 14 | var palette = ['black', 'white']; 15 | var demRGB = dem.visualize({ 16 | min: -5, 17 | max: 5, 18 | palette: palette 19 | }); 20 | Map.addLayer(demRGB, {}, 'DEM'); 21 | 22 | var utils = require('users/gena/packages:utils'); 23 | 24 | var weight = 25 | 0.4; // Weight of Hillshade vs RGB (0 - flat, 1 - hillshaded). 26 | var exaggeration = 5; // Vertical exaggeration. 27 | var azimuth = 315; // Sun azimuth. 28 | var zenith = 20; // Sun elevation. 29 | var brightness = -0.05; // 0 - default. 30 | var contrast = 0.05; // 0 - default. 31 | var saturation = 0.8; // 1 - default. 32 | var castShadows = false; 33 | 34 | var rgb = utils.hillshadeRGB( 35 | demRGB, dem, weight, exaggeration, azimuth, zenith, 36 | contrast, brightness, saturation, castShadows); 37 | 38 | Map.addLayer(rgb, {}, 'DEM (no shadows)'); 39 | 40 | var castShadows = true; 41 | 42 | var rgb = utils.hillshadeRGB( 43 | demRGB, dem, weight, exaggeration, azimuth, zenith, 44 | contrast, brightness, saturation, castShadows); 45 | 46 | Map.addLayer(rgb, {}, 'DEM (with shadows)'); 47 | 48 | var palettes = require('users/gena/packages:palettes'); 49 | var palette = palettes.crameri.oleron[50]; 50 | 51 | var demRGB = dem.visualize({min: -5, max: 5, palette: palette}); 52 | 53 | var castShadows = true; 54 | 55 | var rgb = utils.hillshadeRGB( 56 | demRGB, dem, weight, exaggeration, azimuth, zenith, 57 | contrast, brightness, saturation, castShadows); 58 | 59 | Map.addLayer(rgb, {}, 'DEM colormap'); 60 | 61 | // ----------------------------------------------------------------------- 62 | // CHECKPOINT 63 | // ----------------------------------------------------------------------- -------------------------------------------------------------------------------- /Part F - Fundamentals/F6 - ​Advanced Topics/​​F6.0 Advanced Raster Visualization/F60s1-supplemental.js: -------------------------------------------------------------------------------- 1 | var text = require('users/gena/packages:text'); 2 | var gallery = require('users/gena/packages:gallery'); 3 | 4 | Map.centerObject(geometryGallery, 12); 5 | 6 | var images = ee.ImageCollection('COPERNICUS/S2') 7 | .filterDate('2020-01-01', '2022-01-01') 8 | .filterBounds(geometryLabel); 9 | 10 | var imagesMonthly = ee.List.sequence(0, 11).map(function(month) { 11 | month = ee.Number(month); 12 | return images.filter(ee.Filter.calendarRange(month, month.add(1), 'month')) 13 | .select(['B12', 'B8', 'B4']) 14 | .reduce(ee.Reducer.percentile([15])) 15 | .set({ 16 | label: ee.Date.fromYMD(2000, month.add(1), 1).format('MMM') 17 | }); 18 | }); 19 | 20 | imagesMonthly = ee.ImageCollection(imagesMonthly); 21 | 22 | // Render monthly images + label. 23 | var imagesRGB = imagesMonthly.map(function(i) { 24 | var label = text.draw(i.get('label'), geometryLabel, Map.getScale(), { 25 | fontSize: 24, 26 | textColor: 'ffffff', 27 | outlineColor: '000000', 28 | outlineWidth: 3, 29 | outlineOpacity: 0.6 30 | }); 31 | return i.visualize({min: 300, max: 3500}).blend(label); 32 | }); 33 | 34 | // Generate a single filmstrip image (rows x columns). 35 | var rows = 3; 36 | var columns = 4; 37 | var imageFilmstrip = gallery 38 | .draw(imagesRGB, geometryGallery.bounds(), rows, columns); 39 | 40 | Map.addLayer(imageFilmstrip); 41 | 42 | // LGTM (nclinton) 43 | -------------------------------------------------------------------------------- /Part F - Fundamentals/README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | 30 | # Invitation for collaborators: 31 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 32 | 33 | https://google-earth-engine.com/contact/ 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GOOGLE EARTH ENGINE TUTORIALS 2 | 3 | We have included the detail explaination of the cocepts in the blog link below.. Please do visit the blog for details and give feedback if you have any. 4 | https://google-earth-engine.com/ 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## Background 12 |
13 | 14 | This is the collection of tutorials prepared by multiple individuals that were shared publicly as documents for learning purposes. These documents has been converted to web pages and are made easy aceess to the normal users via web page. The entire content of the oage are the hardwork from the authors mentioned in the page itself. We don't own it. We simply made the materials available in very easy and effective way for the users. In a manner of saying we are looking for the value addition of the existing tutorials available for the users. 15 | 16 |
17 | 18 | The entire lab work and explanation includes work from undergraduates, master’s students, PhD students, postdocs, assistant professors, associate professors, and independent consultants. 19 | 20 |
21 | 22 | ### HTML page output for blog is as follows: 23 |
24 |

25 | 26 |

27 |
28 | 29 | 30 | # Invitation for collaborators: 31 | Please feel free to contribute to the document. Let's try bring the spatial data science contents together so that it would be easier for every one to learn and share the knowledge. You can also provide your valuable suggestion from our contact page. 32 | 33 | https://google-earth-engine.com/contact/ 34 | -------------------------------------------------------------------------------- /gee-tutorials.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishnakafle/gee-tutorials/d63ff3a676334821fb76c7964a3aebd9faa2d39f/gee-tutorials.jpg -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krishnakafle/gee-tutorials/d63ff3a676334821fb76c7964a3aebd9faa2d39f/logo.png --------------------------------------------------------------------------------