ee.FeatureCollection.size

Returns the number of elements in the collection.
Usage Returns
FeatureCollection. size () Integer
Argument Type Details
this: collection
FeatureCollection The collection to count.

Examples

Code Editor (JavaScript)

 // FeatureCollection of power plants in Belgium. 
 var 
  
 fc 
  
 = 
  
 ee 
 . 
 FeatureCollection 
 ( 
 'WRI/GPPD/power_plants' 
 ) 
  
 . 
 filter 
 ( 
 'country_lg == "Belgium"' 
 ); 
 print 
 ( 
 'Number of power plants in Belgium' 
 , 
  
 fc 
 . 
 size 
 ()); 

Python setup

See the Python Environment page for information on the Python API and using geemap for interactive development.

 import 
  
 ee 
 import 
  
 geemap.core 
  
 as 
  
 geemap 

Colab (Python)

 # FeatureCollection of power plants in Belgium. 
 fc 
 = 
 ee 
 . 
 FeatureCollection 
 ( 
 'WRI/GPPD/power_plants' 
 ) 
 . 
 filter 
 ( 
 'country_lg == "Belgium"' 
 ) 
 print 
 ( 
 'Number of power plants in Belgium:' 
 , 
 fc 
 . 
 size 
 () 
 . 
 getInfo 
 ()) 
Create a Mobile Website
View Site in Mobile | Classic
Share by: