I have some ids as list and I want to filter them in LUCAS dataset. I made a simple example for my problem.
After filtering, I want results as original-initial order of searchList
. But after filtering, order of features are not in initial order of searchList
. It is important for me to keep initial orders of features.
How can I solve this?
var geometry = ee.Geometry.Polygon(
[[[26.086635245164302, 41.088934497428085],
[26.086635245164302, 41.03457263065797],
[26.14911998637524, 41.03457263065797],
[26.14911998637524, 41.088934497428085]]], null, false);
var dataset = ee.FeatureCollection("JRC/LUCAS_HARMO/THLOC/V1")
.filterBounds(geometry)
//.select('id')
print(dataset)
Map.addLayer(dataset, {}, "LUCAS Points (data)", true);
var searchList = ee.List([950258, 274091, 418881])
var results1 = dataset.filter(ee.Filter.inList('id', searchList))
print(results1)
// results are in order 418881, 950258, 274091
//But results must be in order, 950258, 274091, 418881
results1.sort("id")
. But I don't know if this is what you are looking for.