If I had a dollar for every time I have been asked this question, I would be a millionaire by now. Typically, people start using Google Earth Engine (GEE) via the Javascript web interface and graduate to using Python (via Google Colab), especially while developing deep learning-based workflows for landcover classification and image segmentation.
JavaScript is a good choice for working with GEE's web-based interface and for easy prototyping and visualisation of data. Still, Python is more suitable for scientific computing, data analysis and geospatial analysis tasks. While both languages can be used with GEE, each has pros and cons. The best choice will depend on the specific requirements of the project and the skill set of the developer working on it.
In this post, we explore the pros and cons of using JavaScript and Python on Earth Engine and look at a no-code alternative.
The pros of programming in JavaScript on Earth Engine:
- JavaScript is a popular language widely used by developers worldwide, which makes it easy to find resources and support online.
- It has a large and active community of developers, which makes it easy to find libraries, frameworks, and tools to help with development.
- JavaScript can be executed in the browser, allowing easy prototyping and data visualisation.
- It is well-suited for working with GEE's web-based interface, which allows for easy manipulation of maps and layers.
The cons:
- JavaScript is less popular for scientific computing and data analysis than Python, making it less suitable for more complex geospatial analysis tasks, notably implementing deep learning models.
- JavaScript's handling of large arrays and matrices is less efficient and user-friendly than Python's, making it less suitable for handling large amounts of geospatial data. Consequently, out-of-memory errors are more common with Javascript-based scripts
The pros of programming in Python on Earth Engine:
- Python is a popular language for scientific computing and data science. This makes it a good language for developing machine and deep learning models, even with geospatial data.
- Python has a large ecosystem of libraries and tools for data analysis and visualisation, such as Numpy, Pandas, matplotlib, and many more that can be used with GEE.
- It has a user-friendly and expressive syntax, which makes it easy to write and understand code.
The cons:
- Python's libraries and tools for GIS are less well-developed than those for JavaScript, making it less suitable for working with GEE's web-based interface.
- Python's development environment can be more complex to set up and maintain than JavaScript's owing to package incompatibilities across different Python versions.
Deep learning applications in Earth Engine depend on Python
However for deep learning applications, users have to use Python and potentially need access to the Google Cloud Platform (which may incur a fee, even for academic users). Several libraries in Python for deep learning, such as TensorFlow and Keras, can be used with GEE. For example, using TensorFlow and Keras, one can train a convolutional neural network (CNN) on satellite imagery to classify land cover types or detect objects like buildings, roads, or water bodies.
My student Mr Davide Lomeo (now a PhD candidate at KCL), and I developed a CNN-based workflow for mapping the mangrove types in South East Asia using Google Earth Engine. The “Cloud-Based Monitoring and Evaluation of the Spatial-Temporal Distribution of Southeast Asia’s Mangroves Using Deep Learning" paper was published in Remote Sensing (see figure 1).
While GEE’s deep learning capabilities are commendable, several shortcomings must be considered. GEE currently supports TensorFlow, Keras and other libraries but doesn't support all the deep learning frameworks and libraries available in Python or other programming languages. This can make using certain deep learning models or models pre-trained on other datasets difficult.
Because GEE is a cloud-based platform, users have limited control over the resources available for deep learning, such as processing power and memory. This can make it difficult to train large or complex deep learning models or perform real-time data processing. It may need help handling enormous datasets or performing complex analyses compared to other cloud-based platforms, such as AWS, Azure or GCP, specifically designed for deep learning.
The no-code alternative to Google Earth Engine
The Javascript and Python routes to GEE can be a steep learning curve, even for those with a programming background. But you don’t have to worry about missing out on GEE’s geo-computational superpowers, thanks to Earth Blox.
Earth Blox allows anybody, anywhere, to create their data analyses using Google Earth Engine's petabyte-scale planetary datasets without having any special coding expertise. The lego-like, drag-and-drop interface makes building and running a workflow in minutes easy.
Learn more about getting up and running on Earth Blox here.
Dr Minerva Singh
Dr Minerva Singh is a data scientist and educator specialising in deep learning and Earth observation. She holds a PhD (University of Cambridge, UK), MPhil (School of Geography, and Environment) and an MSc (Department of Engineering) from Oxford University. Over 90,000 students have taken her online training courses on remote sensing in R and Python on platforms like QGIS and Google Earth Engine.