I have a FeatureCollection with points loaded from an asset (shapefile). Since the system:index is empty, gee assigns a weird index to each feature (e.g. 000000000001, 0000000000a). This causes problems if I want to some mapping and extracting over the FeatureCollection. Can I change the system:index to a sequence from 0 to length of the features?
var asset_points = ee.FeatureCollection("users/slisovski/AssetPoints");
// Map.addLayer(asset_points, {color: 'FF0000'}, "coordinates");
print(asset_points);
var id01 = ee.Feature(asset_points.first()).get("system:index");
print(id01);
var len = asset_points.toList(10000).length().subtract(1);
var idList = ee.List.sequence(0,len);
var assetID = asset_points.set('system:index', idList);
print(assetID);
https://code.earthengine.google.com/bfcfa65f704505889f2bc4d16c909f37
I created the shapefile in R. Maybe I can change this code to make sure that the system:index is sensible?
library(sf)
tab <- data.frame(ID = paste0("ID_", letters[1:20]), Longitude = runif(20, 110, 150), Latitude = runif(20, 20, 80))
data_sf <- tab %>% st_as_sf(.,coords=c("Longitude", "Latitude"),crs = st_crs(world))
st_write(data_sf, dsn = "AssetPoints.shp", driver = "ESRI Shapefile")
Best Answer
You could do that in the GEE after uploading for example as follows:
link code. As your FC was not shared, I made a dummy one. It should work similar for your FC.