giswqs/earthengine-py-notebooks
A collection of 300+ Jupyter Python notebook examples for using Google Earth Engine with interactive mapping
repo name | giswqs/earthengine-py-notebooks |
repo link | https://github.com/giswqs/earthengine-py-notebooks |
homepage | |
language | Jupyter Notebook |
size (curr.) | 16674 kB |
stars (curr.) | 408 |
created | 2020-01-25 |
license | MIT License |
earthengine-py-notebooks
A collection of 300+ Jupyter Python notebook examples for using Google Earth Engine with interactive mapping
Contact: Qiusheng Wu (https://wetlands.io)
1. Description
This repository is a collection of 300+ Jupyter Python notebook examples. I developed these examples by converting my other repo qgis-earthengine-examples from Python scripts to Jupyter notebooks. Now you can display Earth Engine data layers interactively in Jupyter notebooks without having to install QGIS. Three Python packages are being used in these examples, including the Earth Engine Python API, folium, and geehydro. The geehydro Python package builds on the folium package and implements several methods for displaying Earth Engine data layers, such as Map.addLayer()
, Map.setCenter()
, Map.centerObject()
, and Map.setOptions()
.
2. Usage
- Step 1: Explore this repository and open any available Jupyter notebook in your browser (e.g., template.ipynb)
- Step 2: When the selected Jupyter notebook is open, click the Notebook Viewer link to view the interactive map.
- Step 3: If you would like to execute cells in the notebook interactively, you will need to Sign up for a Google Earth Engine account. Then you can click either Run in Google Colab or Run in binder to execute code interactively. This will allow you to add your own Earth Engine Python script.
3. How to automatically convert Earth Engine JavaScript to Python script?
Keep in mind that the conversion might not always work prefectly. Additional manual changes might still be needed. ui
and chart
are not supported.
- Download convert_js_to_python.py.
- To convert one GEE JavaScript to Python script:
js_to_python(in_file_path, out_file_path)
- To convert all GEE JavaScripts in a folder recursively to Python scripts:
js_to_python_dir(in_dir, out_dir)
- To convert all GEE Python scripts in a folder recursively to Jupyter notebooks:
py_to_ipynb_dir(in_dir, in_template)
- To execute all GEE Jupyter notebooks in a folder recursively:
execute_notebook_dir(in_dir)
4. Demo
5. Examples
The Table of Contents below mimics the structure of the Google Earth Engine API Documentation. I strongly encourage you to check out the API Documentation if you need an in-depth explanation of each Python example. Please note that the list below does not include all the Python examples contained in this repository. You are welcome to explore the repository and find more examples to suit your needs.
Get Started
- Hello world!
- Adding data to Map
- Finding images
- Band math
- Mapping (what to do instead of a for-loop)
- Reducing
- Image statistics
- Masking
- A complete example
Machine Learning
- Supervised Classification Algorithms
- Unsupervised Classification Algorithms
Image
- Image Overview
- Image Visualization
- Image information and metadata
- Mathematical operations
- Relational, conditional and Boolean operations
- Convolutions
- Morphological Operations
- Gradients
- Edge detection
- Spectral transformations
- Texture
- Object-based methods
- Cumulative Cost Mapping
- Registering Images
- Miscellaneous
- Band statistics (min, max, mean, std) | Image statistics by band | Extract value to points | Rename bands | Clipping | Find image by path and row | Get image resolution | Get image extent | Set image properties | Select bands | Convert bands to ImageCollection | Reclassify | Composite bands | Image smoothing | Download image | Cell statistics | Image patch area | Get image id | Get band name and type | Filtering by calendar range
ImageCollection
- ImageCollection Overview
- ImageCollection Information and Metadata
- Filtering an ImageCollection
- Mapping over an ImageCollection
- Reducing an ImageCollection
- Compositing and Mosaicking
- Miscellaneous
Geometry, Feature, FeatureCollection
- Geometry Overview
- Geodesic vs. Planar Geometries
- Geometry Visualization and Information
- Geometric Operations
- Feature Overview
- FeatureCollection Overview
- Feature and FeatureCollection Visualization
- FeatureCollection Information and Metadata
- Filtering a FeatureCollection
- Mapping over a FeatureCollection
- Reducing a FeatureCollection
- Vector to Raster Interpolation
- Miscellaneous
- Add new attribute | Add area column | Add random value column | Single column statistics | Multiple column statistics | Simplify polygons | Column statistics by group | Select by location | Select by attributes | Select by strings | Vector symbology | Merge FeatureCollection | Search by buffer distance | Select columns | Mimimum bounding geometry | Clipping polygons
Reducer
- Reducer Overview
- ImageCollection Reductions
- Image Reductions
- Statistics of an Image Region
- Statistics of Image Regions
- Statistics of Image Neighborhoods
- Statistics of FeatureCollection Columns
- Raster to Vector Conversion
- Vector to Raster Conversion
- Grouped Reductions and Zonal Statistics
- Weighted Reductions
- Linear Regression
Join
Array
Specialized Algorithms
- Landsat Algorithms
- Sentinel-1 Algorithms
- Resampling and Reducing Resolution
- Linear fit
- Pattern recognition
Asset Management
- Exporting Image
- Exporting ImageCollection
- Exporting Vector
- Exporting FeatureCollection
- Exporting CSV
- Exporting Table
- Exporting TimeSeries
How Earth Engine Works
Filter
- Filter to metadata equal to the given value
- Filter to metadata not equal to the given value
- Filter on metadata contained in a list
- Filter on metadata that cotains a certain string
- Filter on metadata that starts with a certain string
- Filter on metadata that ends with a certain string
- Filter on metadata that falls within a specified range
Visualization
- RGB composite
- Color palettes
- Color ramp
- Hillshade
- Image stretch
- Image thumbnail
- Rendering categorical maps
- Styled layer descriptors
- Terrain visualization
- Visualizing FeatureCollection
- Visualizing Geometry
- NLCD Land Cover
- US Counties
- Miscellaneous
Datasets
- Terrain
- Water
- Vector datasets catalog
- Large Scale International Boundary Polygons (LSIB)
- TIGER: US 2018 Census Counties
- TIGER: US 2018 Census States
- TIGER: US 2016 Census Roads
- TIGER: US 2010 Census Blocks
- TIGER: US Census 2010 Census Tracts + Demographic Profile 1 aggregate statistics
- TIGER: US Census 2010 5-digit ZIP Code Tabulation Areas
- GLIMS: Global Land Ice Measurements from Space
- USGS Watershed Boundary Datasets
- USA EPA Ecoregions
- RESOLVE Ecoregions
- World Database on Protected Areas (WDPA)
- WRI Global Power Plant Database
- Landsat WRS-2 grid