GEE Feature Selection – How to Select Individual Feature from ImageCollection in Google Earth Engine

google-earth-engine

I am interested in using the .sampleRegions function to extract values from the following ImageCollection. In order to do this, I want to select the middle of the three images (index=1) contained within this image collection. Can anyone help me figure out how to select this image from the ImageCollection?

var MFR = ee.ImageCollection("LANDFIRE/Fire/MFRI/v1_2_0")
print(MFR)

output:

type: ImageCollection
id: LANDFIRE/Fire/MFRI/v1_2_0
version: 1633090983238815
bands: []
features: List (3 elements)
properties: Object (14 properties)

If I use .first(), I get the first image which has the desired form, but is the wrong image:

var MFR = ee.ImageCollection("LANDFIRE/Fire/MFRI/v1_2_0").first()
print(MFR)

output:

Image LANDFIRE/Fire/MFRI/v1_2_0/AK (1 band)
type: Image
id: LANDFIRE/Fire/MFRI/v1_2_0/AK
version: 1629985810765077
bands: List (1 element)
properties: Object (6 properties)

Is there an easy way to select the second image?

Best Answer

Since you know the image id from your script, you can call the image by image id. As in the code below:

var dataset = ee.Image('LANDFIRE/Fire/MFRI/v1_2_0/CONUS');