F12c Checkpoint
Import libraries¶
In [ ]:
Copied!
import ee
import geemap
import ee
import geemap
Create an interactive map¶
In [ ]:
Copied!
Map = geemap.Map(center=[40, -100], zoom=4)
Map = geemap.Map(center=[40, -100], zoom=4)
Add Earth Engine Python script¶
In [ ]:
Copied!
# Add Earth Engine dataset
image = ee.Image("USGS/SRTMGL1_003")
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Chapter: F1.2 Survey of Raster Datasets
# Checkpoint: F12c
# Authors: Andréa, Karen, Nick Clinton, David Saah
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##/
# Collections of single images - Landsat 8 Surface Reflectance
##/
# Create and Earth Engine Point object over San Francisco.
pointSF = ee.Geometry.Point([-122.44, 37.76])
# Import the Landsat 8 Surface Reflectance collection.
landsat8SR = ee.ImageCollection("LANDSAT/LC08/C02/T1_L2")
# Filter the collection and select the first image.
landsat8SRimage = (
landsat8SR.filterDate("2014-03-18", "2014-03-19").filterBounds(pointSF).first()
)
print("Landsat 8 Surface Reflectance image", landsat8SRimage)
# Center map to the first image.
Map.centerObject(landsat8SRimage, 8)
# Add first image to the map.
Map.addLayer(
landsat8SRimage,
{"bands": ["SR_B4", "SR_B3", "SR_B2"], "min": 7000, "max": 13000},
"Landsat 8 SR",
)
# -----------------------------------------------------------------------
# CHECKPOINT
# -----------------------------------------------------------------------
# Add Earth Engine dataset
image = ee.Image("USGS/SRTMGL1_003")
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Chapter: F1.2 Survey of Raster Datasets
# Checkpoint: F12c
# Authors: Andréa, Karen, Nick Clinton, David Saah
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##/
# Collections of single images - Landsat 8 Surface Reflectance
##/
# Create and Earth Engine Point object over San Francisco.
pointSF = ee.Geometry.Point([-122.44, 37.76])
# Import the Landsat 8 Surface Reflectance collection.
landsat8SR = ee.ImageCollection("LANDSAT/LC08/C02/T1_L2")
# Filter the collection and select the first image.
landsat8SRimage = (
landsat8SR.filterDate("2014-03-18", "2014-03-19").filterBounds(pointSF).first()
)
print("Landsat 8 Surface Reflectance image", landsat8SRimage)
# Center map to the first image.
Map.centerObject(landsat8SRimage, 8)
# Add first image to the map.
Map.addLayer(
landsat8SRimage,
{"bands": ["SR_B4", "SR_B3", "SR_B2"], "min": 7000, "max": 13000},
"Landsat 8 SR",
)
# -----------------------------------------------------------------------
# CHECKPOINT
# -----------------------------------------------------------------------
Display the interactive map¶
In [ ]:
Copied!
Map
Map