Uncomment the following line to install geemap if needed.
In [ ]:
Copied!
# !pip install geemap
# !pip install geemap
How to get image basic properties and descriptive statistics¶
In [ ]:
Copied!
import ee
import geemap
import ee
import geemap
Create an interactive map¶
In [ ]:
Copied!
Map = geemap.Map()
Map
Map = geemap.Map()
Map
Add images to the map¶
In [ ]:
Copied!
centroid = ee.Geometry.Point([-122.4439, 37.7538])
landsat = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR").filterBounds(centroid).first()
landsat_vis = {"min": 0, "max": 3000, "bands": ["B5", "B4", "B3"]}
Map.centerObject(centroid, 8)
Map.addLayer(landsat, landsat_vis, "Landsat-8")
centroid = ee.Geometry.Point([-122.4439, 37.7538])
landsat = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR").filterBounds(centroid).first()
landsat_vis = {"min": 0, "max": 3000, "bands": ["B5", "B4", "B3"]}
Map.centerObject(centroid, 8)
Map.addLayer(landsat, landsat_vis, "Landsat-8")
In [ ]:
Copied!
naip = ee.ImageCollection("USDA/NAIP/DOQQ").filterBounds(centroid).first()
naip_vis = {"bands": ["N", "R", "G"]}
Map.addLayer(naip, naip_vis, "NAIP")
naip = ee.ImageCollection("USDA/NAIP/DOQQ").filterBounds(centroid).first()
naip_vis = {"bands": ["N", "R", "G"]}
Map.addLayer(naip, naip_vis, "NAIP")
Get image property names¶
In [ ]:
Copied!
landsat.propertyNames().getInfo()
landsat.propertyNames().getInfo()
In [ ]:
Copied!
landsat.get("CLOUD_COVER").getInfo()
landsat.get("CLOUD_COVER").getInfo()
In [ ]:
Copied!
# The number of milliseconds since 1970-01-01T00:00:00Z.
landsat.get("system:time_start").getInfo()
# The number of milliseconds since 1970-01-01T00:00:00Z.
landsat.get("system:time_start").getInfo()
In [ ]:
Copied!
ee.Date(landsat.get("system:time_start")).format("YYYY-MM-dd").getInfo()
ee.Date(landsat.get("system:time_start")).format("YYYY-MM-dd").getInfo()
Get image properties all at once¶
In [ ]:
Copied!
landsat_props = geemap.image_props(landsat)
landsat_props.getInfo()
landsat_props = geemap.image_props(landsat)
landsat_props.getInfo()
In [ ]:
Copied!
landsat_props.get("IMAGE_DATE").getInfo()
landsat_props.get("IMAGE_DATE").getInfo()
In [ ]:
Copied!
naip_props = geemap.image_props(naip)
naip_props.getInfo()
naip_props = geemap.image_props(naip)
naip_props.getInfo()
In [ ]:
Copied!
naip_props.get("NOMINAL_SCALE").getInfo()
naip_props.get("NOMINAL_SCALE").getInfo()
Get image descriptive statistics¶
Including minimum, maximum, mean, standard deviation, and sum.
In [ ]:
Copied!
landsat_stats = geemap.image_stats(landsat, scale=90)
landsat_stats.getInfo()
landsat_stats = geemap.image_stats(landsat, scale=90)
landsat_stats.getInfo()
In [ ]:
Copied!
naip_stats = geemap.image_stats(naip, scale=10)
naip_stats.getInfo()
naip_stats = geemap.image_stats(naip, scale=10)
naip_stats.getInfo()