I have an array of provinces that I want to be able to select from a drop-down in Google Earth Engine. However, it keeps returning the following error message: "Items must be a string or an object containing a label and value property."

I want to be able to use the selected province as the boundary for time series graphs later in the function. Does anyone know why I get this error message?

//Create filters for each province

var Blekinge = 

var Dalarna = 

var Norrland = 

var Gotland = 

var Medelpad = 

var Provinces3 = [Blekinge, Dalarna, Norrland, Gotland, Medelpad];

//Province selection

var panel = ui.Panel();

width: '400px',
position: 'top-left'


//Add drop-down selection for the provinces
var aoi = panel.add(ui.Select({

  items: Provinces3,


I leave you an example on how to do it explaining each step as a comment in the code. If you need more explanation please tell me and I'll try to do it.

var table = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017");
var name_property = 'country_na'

// Country Names
var all = ee.List(table.toList(table.size()).map(function(feat){return ee.String(ee.Feature(feat).get(name_property))}))
var some = ee.List(['Argentina', 'Chile', 'Uruguay'])

//var table = ee.FeatureCollection("???")
//var name_property = 'Prov_name'
//var Provinces3 = [Blekinge, Dalarna, Norrland, Gotland, Medelpad]
//var some = ee.List(Provinces3)

// empty panel
var panel = ui.Panel()

var timeSeries = function(feature) {
  // Your code for time series graph..
  var name = ee.String(feature.get(name_property)).getInfo()
  print('I am plotting a time series for '+name)

// Main function
var addFeat = function(name, fc, property) {
  // Filter Feature by its name
  var filtered = fc.filterMetadata(property, 'equals', name)
  var feature = ee.Feature(filtered.first())

  // Apply time series code..

  // Add Layer to Map
  var layer = ui.Map.Layer(feature, {}, name)
  var layers = Map.layers()
  layers.set(0, layer)

// Callback for dropdown menu
var callback = function(name) {
  addFeat(name, table, name_property)

// Define dropdown
var drop = ui.Select({
  items: some.getInfo(),
  //items: all.getInfo(),
  onChange: callback

// Adds

Try it here: https://code.earthengine.google.com/d8967ff35492177d824955ba034267b6

  • This code works for what you describe and I very much appreciate the effort, however what I should have told you earlier is that each province also has smaller districts, so the end result is a drop-down menu containing several of the same province (as many as there are districts). – IskJon Feb 26 '19 at 18:39
  • How will you know which one is the one you want? – Rodrigo E. Principe Feb 26 '19 at 19:43
  • A mean of the districts contained within the province, to create a boundary selection for the province as a whole. Then the drop-down would contain a single value for each province that is representative. – IskJon Feb 26 '19 at 20:13
  • 1
    I think I can accomplish that with a dissolve, no worries. – IskJon Feb 28 '19 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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