#!/usr/bin/env python # coding: utf-8 # In[ ]: import ee import geemap from bqplot import pyplot as plt # In[ ]: Map = geemap.Map() Map.add_basemap("TERRAIN") Map # In[ ]: image = ee.Image('USGS/SRTMGL1_003') vis_params = { 'min': 0, 'max': 4000, 'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']} Map.addLayer(image, vis_params, 'SRTM DEM', True, 0.5) # In[ ]: # Use the drawing tool to draw any line on the map. line = Map.user_roi if line is None: line = ee.Geometry.LineString([[-120.223279, 36.314849], [-118.926969, 36.712192], [-117.202217, 36.756215]]) Map.addLayer(line, {}, "ROI") Map.centerObject(line) # In[ ]: line.getInfo() # In[ ]: reducer='mean' # Any ee.Reducer, e.g., mean, median, min, max, stdDev transect = geemap.extract_transect(image, line, n_segments=100, reducer=reducer, to_pandas=True) # In[ ]: transect # In[ ]: fig = plt.figure() plt.plot(transect['distance'], transect[reducer]) plt.xlabel('Distance') plt.ylabel("Elevation") plt.show()