Path: blob/master/examples/python/earthengine_js_to_ipynb.py
2313 views
import os1from geemap.conversion import *23# Create a temporary working directory4work_dir = os.path.join(os.path.expanduser("~"), "geemap")5# Get Earth Engine JavaScript examples. There are five examples in the geemap package folder.6# Change js_dir to your own folder containing your Earth Engine JavaScripts, such as js_dir = '/path/to/your/js/folder'7js_dir = get_js_examples(out_dir=work_dir)89# Convert all Earth Engine JavaScripts in a folder recursively to Python scripts.10js_to_python_dir(in_dir=js_dir, out_dir=js_dir, use_qgis=True)11print("Python scripts saved at: {}".format(js_dir))1213# Convert all Earth Engine Python scripts in a folder recursively to Jupyter notebooks.14nb_template = get_nb_template() # Get the notebook template from the package folder.15py_to_ipynb_dir(js_dir, nb_template)1617# Execute all Jupyter notebooks in a folder recursively and save the output cells.18execute_notebook_dir(in_dir=js_dir)192021