Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
spatialthoughts committed Jan 26, 2024
1 parent 2563c45 commit 88c3c71
Show file tree
Hide file tree
Showing 17 changed files with 1,036 additions and 952 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ var filtered = s2.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 30))
var image2019 = filtered.median();
Map.addLayer(image2019, rgbVis, '2019');

// Exercise

// Delete the 'geometry' variable
// Add a point at your chosen location
// Create a median composite for 2020 and load it to the map
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
// Apply a filter to select only the 'Bangalore Urban' district
// Display only the selected district
var admin2 = ee.FeatureCollection('FAO/GAUL_SIMPLIFIED_500m/2015/level2');
Map.addLayer(admin2, {color: 'grey'}, 'All Admin2 Polygons');

// Hint: The district names are in ADM2_NAME property
// Exercise
// Apply filters to select your chosen Admin2 region
// Display the results in 'red' color

var admin2 = ee.FeatureCollection('FAO/GAUL_SIMPLIFIED_500m/2015/level2');
var karnataka = admin2.filter(ee.Filter.eq('ADM1_NAME', 'Karnataka'));
// Hint1: Swith to the 'Inspector' tab and click on any
// polygon to know its properties and their values

var visParams = {'color': 'red'};
// Hint2: Many countries do not have unique names for
// Admin2 regions. Make sure to apply a filter to select
// the Admin1 region that contains your chosen Admin2 region
11 changes: 7 additions & 4 deletions code/end_to_end_gee/01-Earth-Engine-Basics/06c_Import_(exercise)
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
var urban = ee.FeatureCollection('users/ujavalgandhi/e2e/ghs_urban_centers');
print(urban.first());

// Exercise
// Apply a filter to select only large urban centers
// in your country and display it on the map.

// Select all urban centers in your country with
// a population greater than 1000000

// Use the property 'CTR_MN_NM' containing country names
// Use the property 'P15' containing 2015 Population
var urban = ee.FeatureCollection('users/ujavalgandhi/e2e/ghs_urban_centers');
print(urban.first())
// Hint1: Use the property 'CTR_MN_NM' containing country names
// Hint2: Use the property 'P15' containing 2015 Population

Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
var s2 = ee.ImageCollection('COPERNICUS/S2_HARMONIZED');
var urban = ee.FeatureCollection('users/ujavalgandhi/e2e/ghs_urban_centers');

// Change the filter to your home city or any urban area of your choice
// Find the name of the urban centre
// by adding the layer to the map and using Inspector.
var filtered = urban.filter(ee.Filter.eq('UC_NM_MN', 'Bengaluru'));

var geometry = filtered.geometry();
Expand All @@ -23,3 +20,8 @@ var clipped = image.clip(geometry);

Map.addLayer(clipped, rgbVis, 'Clipped');

// Exercise
// Change the filter to your home city or any urban area of your choice

// Hint: Find the name of the urban centre by adding the
// 'urban' layer to the map and using Inspector.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Map.addLayer(clipped, rgbVis, 'Clipped');

var exportImage = clipped.select('B.*');

// Export raw image with original pixel values
Export.image.toDrive({
image: exportImage,
description: 'Bangalore_Composite_Raw',
Expand All @@ -32,14 +33,14 @@ Export.image.toDrive({
maxPixels: 1e9
});

// Export visualized image with RGB

// Rather than exporting raw bands, we can apply a rendered image
// visualize() function allows you to apply the same parameters
// that are used in earth engine which exports a 3-band RGB image
print(clipped);

// Note: Visualized images are not suitable for analysis
var visualized = clipped.visualize(rgbVis);
print(visualized);
// Now the 'visualized' image is RGB image, no need to give visParams
Map.addLayer(visualized, {}, 'Visualized Image');

Export.image.toDrive({
image: visualized,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Change the filter to your city
// Write the export function to export the results

var s2 = ee.ImageCollection('COPERNICUS/S2_HARMONIZED');
var urban = ee.FeatureCollection('users/ujavalgandhi/e2e/ghs_urban_centers');

Expand All @@ -24,3 +21,8 @@ Map.addLayer(clipped, rgbVis, 'Clipped');

var exportImage = clipped.select('B.*');

// Exercise
// Change the filter to select your city
// Write the export function to export the results


Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
var s2 = ee.ImageCollection('COPERNICUS/S2_HARMONIZED');
var geometry = ee.Geometry.Point([77.60412933051538, 12.952912912328241]);

var now = Date.now()
var now = ee.Date(now)
var now = Date.now();
var now = ee.Date(now);

// Exercise
// Apply another filter to the collection below to filter images
// collected in the last 1-month
// Do not hard-code the dates, it should always show images
Expand Down
Loading

0 comments on commit 88c3c71

Please sign in to comment.