2

I would like to add a list to each of my points such that it gains the list as a "property". The following script does that:

var points = /* color: #d63000 */ee.List(
[[1.3634359574461996, 31.636034304440155],
 [3.6046468949461996, 31.148372138748694],
 [-0.9656656050538004, 29.172742327143503],
 [2.8575765824461996, 29.172742327143503],
 [0.7042562699461996, 30.506858885801098],
 [-1.6248452925538004, 30.884738935660458],
 [-3.8221109175538004, 27.62655429384725],
 [2.2862875199461996, 25.781544169671214]]);

var mp = ee.FeatureCollection(points.map(function(p){
  var point = ee.Feature(ee.Geometry.Point(p), {})
  return point
}))

var list = ee.List([1,2,3,4,5])

var addList = function(feature) {
  return feature.set({List: list});
};

var listAdded = mp.map(addList)

Export.table.toDrive(listAdded,
"export_Points",
"export_Points",
"export_Points");

However, the table this outputs looks like this: enter image description here

The issue with this is that the list is confined to one cell, rather than something I can work with further. While I could go through and handle this in e.g. Notepad++ or possibly with VBA, it would be far more efficient if the table I got from the export was usable from the start. Is it possible to "transpose" the table in such a way that I have the "system:index" in the top row and the list values in the columns below, like this:

enter image description here

I will keep working on this and post updates if I find anything!

Your Answer

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

Browse other questions tagged or ask your own question.