Skip to content

featureCollection

Rodrigo E. Principe edited this page Nov 10, 2018 · 6 revisions

featureCollection

propertyValues(collection, property)

Get all existing values for the given property. Values in the resulting list do not repeat.

var tools = require('users/fitoprincipe/geetools:tools')

var ft = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017");
var property = 'country_na'

// keep 10 for speed reasons
ft = ft.limit(10)

var names = tools.featureCollection.propertyValues(ft, property)
print(names)
// Return [Brazil, St Helena, Cabo Verde, Portugal,...] 

https://code.earthengine.google.com/bbddbca42fd8e813dff3799633c76a3a

toDictionary(collection, options)

Extracts properties from all features in a FeatureCollection. options must be an object with the following:

  • properties: a list of the properties to extract
  • idField: the property that will be the resulting dictionary key. Be aware that if this id repeats, in the resulting dictionary will be only one.

https://code.earthengine.google.com/bd25d1e5ce0c16548e0fa90cec49d52f

Clone this wiki locally