Extract values
Uncomment the following line to install geemap if needed.
In [1]:
Copied!
# !pip install geemap
# !pip install geemap
In [2]:
Copied!
# import geemap
# geemap.update_package()
# import geemap
# geemap.update_package()
Interactive extraction of pixel values¶
Import libraries¶
In [3]:
Copied!
import os
import ee
import geemap
import os
import ee
import geemap
Create an interactive map¶
In [4]:
Copied!
Map = geemap.Map()
Map
Map = geemap.Map()
Map
Out[4]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Add data to the map¶
In [5]:
Copied!
landsat7 = ee.Image('LE7_TOA_5YEAR/1999_2003').select([0, 1, 2, 3, 4, 6])
landsat_vis = {'bands': ['B4', 'B3', 'B2'], 'gamma': 1.7}
Map.addLayer(landsat7, landsat_vis, "LE7_TOA_5YEAR/1999_2003")
Map.set_plot_options(add_marker_cluster=True)
landsat7 = ee.Image('LE7_TOA_5YEAR/1999_2003').select([0, 1, 2, 3, 4, 6])
landsat_vis = {'bands': ['B4', 'B3', 'B2'], 'gamma': 1.7}
Map.addLayer(landsat7, landsat_vis, "LE7_TOA_5YEAR/1999_2003")
Map.set_plot_options(add_marker_cluster=True)
The folium plotting backend does not support this function.
Activate the plotting tool¶
Tick the Plotting
checkbox and click the mouse on the map to start displaying charts.
Export pixel values to shapefile/csv¶
In [6]:
Copied!
out_dir = os.path.expanduser('~/Downloads')
# out_csv = os.path.join(out_dir, 'points.csv')
out_shp = os.path.join(out_dir, 'points.shp')
out_dir = os.path.expanduser('~/Downloads')
# out_csv = os.path.join(out_dir, 'points.csv')
out_shp = os.path.join(out_dir, 'points.shp')
In [7]:
Copied!
Map.extract_values_to_points(out_shp)
Map.extract_values_to_points(out_shp)
The folium plotting backend does not support this function.
Interactive Region Reduction¶
Import libraries¶
In [8]:
Copied!
import geemap.colormaps as cm
import geemap.colormaps as cm
Create an interactive map¶
In [9]:
Copied!
m = geemap.Map()
m = geemap.Map()
Add add to the map¶
In [10]:
Copied!
collection = (
ee.ImageCollection('MODIS/006/MOD13A2')
.filterDate('2015-01-01', '2019-12-31')
.select('NDVI')
)
# Convert the image collection to an image.
image = collection.toBands()
palette = cm.palettes.ndvi
ndvi_vis = {'min': 0.0, 'max': 9000.0, 'palette': palette}
m.addLayer(image, {}, 'MODIS NDVI Time-series')
m.addLayer(image.select(0), ndvi_vis, 'MODIS NDVI VIS')
m
collection = (
ee.ImageCollection('MODIS/006/MOD13A2')
.filterDate('2015-01-01', '2019-12-31')
.select('NDVI')
)
# Convert the image collection to an image.
image = collection.toBands()
palette = cm.palettes.ndvi
ndvi_vis = {'min': 0.0, 'max': 9000.0, 'palette': palette}
m.addLayer(image, {}, 'MODIS NDVI Time-series')
m.addLayer(image.select(0), ndvi_vis, 'MODIS NDVI VIS')
m
Out[10]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Set reducer¶
In [11]:
Copied!
m.set_plot_options(add_marker_cluster=True, marker=None)
m.roi_reducer = ee.Reducer.mean()
m.set_plot_options(add_marker_cluster=True, marker=None)
m.roi_reducer = ee.Reducer.mean()
The folium plotting backend does not support this function.
Export data¶
In [12]:
Copied!
out_dir = os.path.expanduser('~/Downloads')
# out_csv = os.path.join(out_dir, 'points.csv')
out_shp = os.path.join(out_dir, 'ndvi.shp')
m.extract_values_to_points(out_shp)
out_dir = os.path.expanduser('~/Downloads')
# out_csv = os.path.join(out_dir, 'points.csv')
out_shp = os.path.join(out_dir, 'ndvi.shp')
m.extract_values_to_points(out_shp)
The folium plotting backend does not support this function.
Creating training samples¶
In [13]:
Copied!
import geemap
import geemap
In [14]:
Copied!
geemap.show_youtube("https://youtu.be/VWh5PxXPZw0")
geemap.show_youtube("https://youtu.be/VWh5PxXPZw0")
In [15]:
Copied!
Map = geemap.Map()
Map
Map = geemap.Map()
Map
Out[15]:
Make this Notebook Trusted to load map: File -> Trust Notebook
Last update:
2022-03-25