Skip to main content
29 votes
Accepted

Moving from Earth Engine image to array for use in sklearn

Ideally there would be some way to convert EE image objects to sklearn-readable NumPy arrays directly using the EE Python API. ee.Image.sampleRectangle() does this. However, there is a limit of ...
Justin Braaten's user avatar
9 votes
Accepted

Google Earth Engine: Javascript to Python conversion: syntax error with `image1.and(image2)`

and, or and not are reserved words in Python, use And, Or and Not mask = image1.And(image2)
Rodrigo E. Principe's user avatar
8 votes
Accepted

Resampling image or imagecollection to higher resolution in Google Earth Engine Python API

That's because the process of argument assignment in python is different than that of JS. This part ({'crs': crs,'scale': 10.0}) needs to be replaced with its python equivalent. Your code should ...
Mouad Alami's user avatar
8 votes

Mapping simple function to print date and time stamp on Google Earth Engine Python API

From the JavaScript docs (it's essentially identical to the Python docs, but easier to get to, as it's there in the code editor): ImageCollection.map(algorithm, dropNulls) [...] algorithm ...
Daniel Wiell's user avatar
  • 14.2k
8 votes
Accepted

Using featureCollection to define geometry in Google Earth Engine

I think adding .geometry() after country will work: task_config = { 'image':alerts, 'description':file_name, 'scale': 30, 'region':country.geometry(), 'maxPixels': 1e10
HONGWEI GUO's user avatar
8 votes
Accepted

Using Google Earth Engine JavaScript vs. Python API

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. ...
Tyler Erickson's user avatar
7 votes
Accepted

gcloud command not found when authenticating Google Earth Engine

I was able to solve this issue by rolling back to a previous version using conda install -c conda-forge earthengine-api=0.1.329. I also tested version 0.1.330 and the problem persisted so rolled back ...
nrp1000's user avatar
  • 447
7 votes

Discrepancy between actual size of coordinates and clipped satellite image box sizes

Since you use .first() function, you get one image which you see after the code runs. To solve this issue: (1) remove .first() method and filter the collection by CLOUDY_PIXEL_PERCENTAGE. ...
Kadir Şahbaz's user avatar
6 votes

Extracting pixel time series from Google Earth Engine

Hope you find useful this tutorial: http://www.loicdutrieux.net/landsat-extract-gee/examples.html from geextract import ts_extract, get_date from datetime import datetime import numpy as np import ...
gonzalez.ivan90's user avatar
6 votes

Moving from Earth Engine image to array for use in sklearn

What I've done is download the images as tifs from GEE (something you might have to do in pieces given the size). I used the getDownloadURL() function because it is faster, For larger images use ...
la_leche's user avatar
  • 433
6 votes
Accepted

How to handle large data exports (>100,000 tables)

The problem is not what you think: Batch tasks go into a queue and do not consume any resources until they start running. Memory limits are independent, not shared across all tasks. The problem you ...
Kevin Reid's user avatar
  • 10.4k
6 votes

Transfer an entire Google Earth Engine assets to another Google Earth Engine account

Yes, one way is to use the earthengine python API. First create a new folder through the code editor for your destination folder. Then you can run this peace of code in a jupyter notebook (or colab) ...
aVollrath's user avatar
5 votes

Authentication issue: Earth Engine Python using ee.ServiceAccountCredentials()?

Follow the steps given on this page: https://developers.google.com/earth-engine/guides/service_account Most importantly "Register the service account to use Earth Engine" so what you have to ...
Mint.High's user avatar
5 votes
Accepted

Use Google Earth Engine to read MODIS NDVI into python

This works for me: import ee import numpy as np ee.Initialize() date_start = ee.Date('2004-05-01') end_date = ee.Date('2004-06-12') area = ee.FeatureCollection(r'users/bcoerver/gadm36_PSE_0') # ...
Bert Coerver's user avatar
  • 1,945
5 votes
Accepted

Google Earth Engine data extraction from imagery

Do I need to set proj to NAD83 when defining the Point geometry too: point2 = ee.Geometry.Point([lon, lat],'EPSG:4269') Yes, you must set this to correctly interpret the coordinates. This is the only ...
Kevin Reid's user avatar
  • 10.4k
4 votes

Choosing Google Earth Engine IDE

You can edit your scripts with any IDE you want as long as you include git into your workflow. All the scripts you see are based in git repositories (see GEE docs): The Scripts manager stores ...
Kersten's user avatar
  • 9,909
4 votes
Accepted

Choosing Google Earth Engine IDE

If you are able to use Jupyter Notebook or Lab, I have made a "code editor simulator". Initially I made two ways of using it, one via folium and the other one via ipyleaflet, but I have been ...
Rodrigo E. Principe's user avatar
4 votes
Accepted

Extracting pixel time series from Google Earth Engine

I found the issue. It wasn't the scale, since anything below the native resolution of the product returns the value at the native resolution. The problem was actually a missing parameter in the ...
tda's user avatar
  • 531
4 votes
Accepted

Get Numpy arrays from Google Earth Engine

You can use ee.Image.sampleRectangle() (see this post) for converting GEE images to 2d array. However, there is a limit of 262144 pixels that can be transferred to protect your system from becoming ...
shahryar's user avatar
  • 694
4 votes
Accepted

Export Google Earth Engine Landsat Image to Google Drive not working in Python API

Using your script, I ran taskToexport.status() to check on the status of the download request and an error was returned: error_message: Unable to export unbounded image. You need to provide an ...
Justin Braaten's user avatar
4 votes

Downloading Google Earth Engine Collection to Local Drive

You can export an ImageCollection to Google Drive using only one line of code with the geemap Python package. Check out this notebook example. geemap.ee_export_image_collection_to_drive(collection, ...
Qiusheng Wu's user avatar
4 votes
Accepted

Clipped Image has wrong shape in Google Earth Engine

Calling ee.Geometry.Polygon(coordinates) with no other options gives you a polygon with geodesic edges. Geodesic edges are defined to take the shortest path on the globe between two points. When ...
Kevin Reid's user avatar
  • 10.4k
4 votes
Accepted

How to de-authenticate from Earth Engine API

Credentials are cached in something like ~/.config/earthengine/credentials Removing that file should de-authenticate you
Pierrick Rambaud's user avatar
4 votes

Authentication error when initializing Google EE in QGIS 3.16.1

Traceback (most recent call last): File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\code.py", line 90, in runcode exec(code, self.locals) File "<input>", line 1, in <...
huang ke's user avatar
4 votes
Accepted

What does it mean by scale in reduceRegion function in Google Earth Engine

In this context, scale is the size of one side of a pixel in meters. This is always (?) the case when you find a scale parameter in Earth Engine (more about scale of analysis in EE). Not to be ...
Nicholas Clinton's user avatar
4 votes

Async callbacks with Python API for GEE

Yes, it is possible using one of the few available libraries with similar functionality. Asyncio is the first thing that comes to my mind https://docs.python.org/3/library/asyncio.html You basically ...
dmh126's user avatar
  • 6,732
4 votes
Accepted

Google Earth Engine Python expression syntax

Here is the Python equivalent of your function: def addEVI(image): EVI = image.expression('2.5 * ((NIR - RED) / (NIR + 6 * RED - 7.5 * BLUE + 1))', { 'NIR' : image.select('B8').divide(...
Kadir Şahbaz's user avatar
4 votes
Accepted

Scale Factors application not working on GEE PyQGIS

The second element of .addBands() should be a list; which uses square brackets ( [] ), not braces/curly brackets ( {} ). Changing that makes your code run: Edit: an empty list ([]) doesn't seem to ...
hooge048's user avatar
  • 794
4 votes
Accepted

Earth Engine Python API set system:id property with function

getInfo() is a client-side operation and cannot be used in map(). Likewise, Python list subsetting [0:4] cannot be used inside map() either. Instead, you can use the server-side slice to substring the ...
Matt's user avatar
  • 16.9k
4 votes
Accepted

Google Earth Engine - calling 'mean' on ImageCollection only produces scalar value

You should set the scale and crs (or crsTransform and crs) parameters in the export call. When you reduce an image collection the result has a default projection that has 1-degree pixel size in WGS84 ...
Justin Braaten's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible