I have created an image from the crop landcover dataset containing only the crop type rice (crop_rice). I hoping to make a feature collection (Geometric Points) on all points containing rice. Any ideas on how to go on doing that?

//Select first image crop landcover data set
var dataset = ee.ImageCollection('USDA/NASS/CDL')
              .filter(ee.Filter.date('2017-01-01', '2018-12-31'))

//select band cropland from image
var img_cropLC = dataset.select('cropland');
Map.setCenter(-100.55, 40.71, 4);

//Add visualization layer to view all crop types in the image
Map.addLayer(img_cropLC, {}, 'Crop Landcover');


//Select all pixel with crop type:Rice (crop class values = 3)
var crop_rice = ee.Image(img_cropLC).eq(3)

//Add a visualization layer to view rice 
},'Rice Layer')

enter image description here


The full dataset is for continental US. A bit much to turn into points.

If you zoom in further to your image, you can see that it isn't individual pixels, but actually pixel groups.enter image description here

It is easy to vectorise this with a reduceToVectors() function, but without knowing what the aim of the Feature Collection, it is difficult to tell you which direction to take.

Here is the code to vectorise, making an AOI that is a bit smaller.

var geometry = 
    /* color: #d63000 */
    /* displayProperties: [
        "type": "rectangle"
    ] */
        [[[-90.24970964301264, 35.703887942106476],
          [-90.24970964301264, 35.564090282847935],
          [-90.04302934516107, 35.564090282847935],
          [-90.04302934516107, 35.703887942106476]]], null, false);

var AOI_rice = crop_rice.reduceToVectors({geometry:geometry})

Map.addLayer(AOI_rice,{},"Rice Vectors")

However, if you are going to use the rice layer for other calculations, Noel Gorelick has always pointed out that Earth Engine has much higher limits if you stay in image space than in table space.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.