73 transect
In [ ]:
Copied!
import ee
import geemap
from bqplot import pyplot as plt
import ee
import geemap
from bqplot import pyplot as plt
In [ ]:
Copied!
Map = geemap.Map()
Map.add_basemap("TERRAIN")
Map
Map = geemap.Map()
Map.add_basemap("TERRAIN")
Map
In [ ]:
Copied!
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)
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 [ ]:
Copied!
# 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)
# 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 [ ]:
Copied!
line.getInfo()
line.getInfo()
In [ ]:
Copied!
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
)
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 [ ]:
Copied!
transect
transect
In [ ]:
Copied!
fig = plt.figure()
plt.plot(transect['distance'], transect[reducer])
plt.xlabel('Distance')
plt.ylabel("Elevation")
plt.show()
fig = plt.figure()
plt.plot(transect['distance'], transect[reducer])
plt.xlabel('Distance')
plt.ylabel("Elevation")
plt.show()
Last update:
2023-03-19
Created: 2020-04-12
Created: 2020-04-12