I want to transform a ee.Iamge that descripbe the ecozone of a specific country to a vector. I try to reproduce this example but I cannot get anything else than black vector...
//load the country
var country = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017').filter(ee.Filter.eq('country_co', 'CG'));
//load the ecozones
var gez_2010 = ee.Image('users/bornToBeAlive/gez_2010_wgs84')
var country_gez_2010 = gez_2010.select('b1').clip(country)
country_gez_2010
has only one band b1
with int
values from 0 to 21.
//construct the zones
var zones = country_gez_2010.eq(0)
var i
for (i=1; i<21;i++){
zones = zones.add(country_gez_2010.eq(i))
}
//Convert the ecozones to vectors.
var vectors = zones.addBands(country_gez_2010).reduceToVectors({
'geometry': country,
'crs': country_gez_2010.projection(),
'scale': 100,
'geometryType': 'polygon',
'eightConnected': false,
'labelProperty': 'ecozone',
'reducer': ee.Reducer.min(),
'maxPixels': 1e9
})
//display it on the map
var display = ee.Image(0).updateMask(0).paint(vectors, '000000');
Map.addLayer(display, {palette: '000000'}, 'vectors');
I'm doubting on the zones
definition and the reducer
selection but maybe it's something else