0

I have tried to extract the data in a specific column of my featureCollection using .reduceColumns, but got nothing. Other columns work, but the column "Image_ID" is not working. I thought it was because of the number of characters, but the column "Region" is longer and shows properly.

This is my script:

// Import data
var table = ee.FeatureCollection('users/lizcanosandoval/images_list_example')

// See column names:
print(table.first().propertyNames())

/*
0: Satellite
1: Year
2: Image_ID
3: Tile_ID
4: system:index
*/

print(table.reduceColumns(ee.Reducer.toList(), ['Image_ID']).get('list')) // Showing empty list

print(table.reduceColumns(ee.Reducer.toList(), ['Region']).get('list')) // Showing a list correctly

How can I get the data in a list?

Edit: The column names and information is there when exploring the collection properties in Earth Engine: enter image description here

1 Answer 1

1

Updated Solution

It appears that your column name is not actually Image_ID. When I use the property name list to reference Image_ID rather than using a string, the function runs properly. Upon further investigation, there appears to be an invisible character in front of Image_ID that is erased on some browsers. Including the invisible character correctly displays the Image_ID. Please see the image below for the invisible character in case your browser can't display it correctly in the demo script. In addition to getting the Image_ID to list properly, I have changed your column extraction to the method that I find works better for me using .aggergate_array().

Working Code: https://code.earthengine.google.com/3eb911dc5c535dbdb8d4d536b3b0786f

Invisible Character

Original Solution I am unable to access the table, likely because of permission settings. Please make sure that the table is shared so that "Anyone can read".

Additionally, your syntax for importing the table data is wrong in this script. currently your table variable is a string. To call your table data, you will need to use ee.FeatureCollection('users/lizcanosandoval/images_list_example')

Some possible issues that you might have are:

  1. The column name is not 'Image_ID'. This can happen sometimes when you export the data from other GIS platforms like ArcGIS which sometimes changes the column names on export.
  2. The Image_ID column is empty. This can also happen sometimes when you export the data from other GIS platforms, especially if the data type is not compatible with Earth Engine.
3
  • I made the collection public, should be ok now. The Image_ID is the only one that is not working, the other columns work well. The info is there under the Image_ID name as you can see when exploring the properties in Earth Engine. How can extract the info in that column? Jan 25, 2022 at 17:13
  • @LuisLizcano Thanks for making the collection public. I have updated the answer with a full solution. Jan 27, 2022 at 11:33
  • Wow that was tricky! How did you know how to solve it? Would it be the same solution everytime this error happen? Feb 3, 2022 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.