I need to convert a Feature Collection containing only numeric data to a 2D matrix. I have written the following code however it gives matA
as a list of arrays despite explicit type conversion, here table
is my feature collection and data
is the list of properties I need to extract into the matrix
// list of data to extract from FC
var data=ee.List(['bio01','bio02','bio03','bio04','bio05','bio06','bio07',
'bio08','bio09','bio10','bio11','bio12','bio13','bio14',
'bio15','bio16','bio17','bio18','bio19','dem','tmax','tmin','prec']);
//data becomes the list from which the user wants to remove the ones he doesn't need
var tableArray=table.toList(200,0) // list of features
var tableList=ee.List(tableArray.map(function(element){
var feat=ee.Feature(element)
var array=feat.toArray(data) //feature to array
return ee.List(array) //array to list
}))
// array needs all elements of list only not array inside list so we change feature to list
var matA=ee.Array(tableList)
print(matA)
The error I am getting is:
Array (Error)
Array: Unrecognized type, may only use numbers or lists, found type Array.