I am using Google Earth Engine in hopes to export a polygon from the HydroATLAS feature collection as a shapefile. This is the code I have tried:

// HydroATLAS data
var basinATLAS = ee.FeatureCollection('WWF/HydroATLAS/v1/Basins/level03');

// Create a point that intersects only the Amazon Basin
var amazon_point = ee.Geometry.Point(-55,-10); // degE, degN

// Filter to get the polygon containing the point defined above
var amazonBasin = basinATLAS.filterBounds(amazon_point);

// Export the feature as a shapefile
  collection: amazonBasin,
  description: 'Amazon_Basin_Shapefile',
  fileFormat: 'SHP'

The code runs successfully; however, the export task fails. It gives the following error:

Error: Shapefile field limit exceeded: The maximum number of fields in a Shapefile is 255. (Error code: 3).

1 Answer 1


The error is indicating exactly what the problem is: the number of fields in the FeatureCollection is higher than the number of fields a shapefile admits, i.e., 255. In order to export it correctly, you just need to select the feature's properties you are interested in. To inspect the properties names, you just need to consult the FeatureCollection info (Table Schema tab) or print it in the console and inspect the properties names. In this example, I chose two properties and exported the FeatureCollection without any problem. You just need to add the following to your OP.

// Filter to get the polygon containing the point defined above
var amazonBasin = basinATLAS.filterBounds(amazon_point)
 .select(['PFAF_ID', 'SUB_AREA']);
  • Exactly what I was looking for, thank you!
    – Austin
    Jul 19, 2023 at 14:12

Your Answer

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

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