Giter Site home page Giter Site logo

giswqs / earthengine-py-notebooks Goto Github PK

View Code? Open in Web Editor NEW
1.3K 94.0 399.0 17.14 MB

A collection of 360+ Jupyter Python notebook examples for using Google Earth Engine with interactive mapping

Home Page: https://gishub.org/geemap-notebooks

License: MIT License

Python 36.64% Jupyter Notebook 61.42% JavaScript 1.94%
earth-engine google-earth-engine gis remote-sensing python notebook notebook-jupyter geospatial tutorials earthengine

earthengine-py-notebooks's Introduction

earthengine-py-notebooks

image image image image image image image image Twitter Follow

A collection of 360+ 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 360+ 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. Several Python packages are being used in these examples, including the Earth Engine Python API, folium, ipyleaflet, and geemap. The geemap Python package is built upon the folium and ipyleaflet packages and implements several methods for interacting with 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 to execute code interactively. This will allow you to add your own Earth Engine Python script.

3. How to automatically convert Earth Engine JavaScripts to Python scripts?

The following examples require the geemap package, which can be installed using pip install geemap. Check the Installation section for more information.

Launch an interactive notebook with Google Colab. Keep in mind that the conversion might not always work perfectly. Additional manual changes might still be needed. ui and chart are not supported. The source code for this automated conversion module can be found at conversion.py.

image

import os
from geemap.conversion import *

# Create a temporary working directory
work_dir = os.path.join(os.path.expanduser('~'), 'geemap')
# Get Earth Engine JavaScript examples. There are five examples in the geemap package folder. 
# Change js_dir to your own folder containing your Earth Engine JavaScripts, such as js_dir = '/path/to/your/js/folder'
js_dir = get_js_examples(out_dir=work_dir) 

# Convert all Earth Engine JavaScripts in a folder recursively to Python scripts.
js_to_python_dir(in_dir=js_dir, out_dir=js_dir, use_qgis=True)
print("Python scripts saved at: {}".format(js_dir))

# Convert all Earth Engine Python scripts in a folder recursively to Jupyter notebooks.
nb_template = get_nb_template()  # Get the notebook template from the package folder.
py_to_ipynb_dir(js_dir, nb_template)

# Execute all Jupyter notebooks in a folder recursively and save the output cells.
execute_notebook_dir(in_dir=js_dir)

image

4. Demo

ee-py-notebooks

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.

earthengine-py-notebooks's People

Contributors

giswqs avatar guy1ziv2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

earthengine-py-notebooks's Issues

Downloading Large Images Mosaic from GEE

Hi Professor,
I hope you are doing good .
I was creating a mosaic for larger area from sentinel 2 collection . Isn't there a way to download those images by chipping into smaller ones ? There is a limit of 1gb but I was trying to download whole cloud free mosaic .

Thank you for your help !

Export landset image...

Hello, professor,

I want to use your GEEMAP library to export pictures. There are 300 examples in your tutorial. I am a bit confused and I don’t know how to use Google Earth.

Can you give some suggestions based on the picture I gave and which examples should I use?

There are two key points:

  1. Add label of localtion, like A in the pic.
  2. Display the image acquisition time.

Thank you very much.
20211122113953

Another question:
I use this script in jupyterlab, there are some error..

image = ee.Image('LANDSAT/LC08/C01/T1_SR/LC08_038029_20180810')

landsat_vis = {
    'bands': ['B4', 'B3', 'B2'], 
    'gamma': 1.4
}
Map.addLayer(image, landsat_vis, "LE7_TOA_5YEAR/1999_2003", True, 0.7)
# Draw any shapes on the map using the Drawing tools before executing this code block
feature = Map.draw_last_feature

if feature is None:
    geom = ee.Geometry.Polygon([[[-115.413031, 35.889467],
    [-115.413031, 36.543157],
    [-114.034328, 36.543157],
    [-114.034328, 35.889467],
    [-115.413031, 35.889467]]])
    feature = ee.Feature(geom, {})

roi = feature.geometry()
import os
out_dir = os.path.join('/root/Downloads')
filename = os.path.join(out_dir, 'landsat.tif')
geemap.ee_export_image(image, filename=filename, scale=90, region=roi, file_per_band=True)

Error like this:

Generating URL ...
An error occurred while downloading.
Total request size (42441000 bytes) must be less than or equal to 33554432 bytes.

FeatureCollection visualization

HI,
I am trying to visualize a feature collection using geemap.
I am not getting any errors but there is no map.
What could be the reason?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.