TransWikia.com

Google Earth Engine: Javascript API vs. Python API

Geographic Information Systems Asked on January 17, 2021

Google Earth Engine seems to be most commonly used through either the Python API, or the Javascript API on the browser. Trying to decide for one, I have come across this comparison, from a Tyler Erickson presentation:
enter image description here

While some differences are clear (e.g. many more plotting options in Python), others are more abstract to me.


Questions:

  1. In practical terms, what are the advantages of being able to make a "series of calls to Earth Engine" in the Python API?
  2. Are there other differences not listed here, perhaps in regards to efficiency when exporting data, or the speed of computations?

One Answer

For additional context on the slide referenced in the question, note that it is comparing using the Earth Engine Code Editor (a web IDE for developing against the Earth Engine JavaScript API) vs. using the Earth Engine Python API. The slide is from a presentation made over 3 years ago, and both the JavaScript and Python APIs have changed and the Code Editor has gained additional features such as the ability to share code between Code Editor scripts using script modules.

For Question #1:

To clarify, a series of requests can be made using either the JavaScript or Python client libraries, and also from within the Code Editor. However, working directly with the Python (or JavaScript) client library gives you more flexibility in terms of what you can do with the results. For example, you can interleave Earth Engine calls with requests to other services and use libraries not currently supported by the Code Editor development environment.

Being able to perform a series of calls facilitates the following examples:

  • Sensitivity Analyses. You can obtain data while varying one (or more) parameters, allowing you to perform a sensitivity analysis. For example, how does the changing scale parameter affect the results obtained from ee.Image.reduceRegion?
  • Series of Outputs. You can produce a series of output images, maps, or tables. For example, you could generate a cloud-free image for every watershed in a country.
  • Jupyter Notebooks. You can develop workflows/tutorials that display intermediate results. For example, see the Jupyter/Colab notebook linked from this tutorial.

For Question #2:

  • There certainly are other differences beyond the simple list shown on the slide, such as some differences in syntax. Another is that the Earth Engine Code Editor allows developers to easily publish hosted applications (Earth Engine Apps), which would require significantly more work to do the same using the Python API.
  • Both the JavaScript and Python APIs utilize a lower-level REST API for computations performed on the Earth Engine backend servers, so there is no computational or export performance benefit of using one over the other.

Correct answer by Tyler Erickson on January 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP