Image Information and Metadata

Print image objects to explore band names, projection information, properties, and other metadata. The following examples demonstrate printing the entire set of image metadata as well as requesting specific metadata elements programmatically.

Getting metadata

Code Editor (JavaScript)

// Load an image.
var image = ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20140318');

// Display all metadata.
print('All metadata:', image);

// Get information about the bands as a list.
var bandNames = image.bandNames();
print('Band names:', bandNames);  // ee.List of band names

// Get projection information from band 1.
var b1proj = image.select('B1').projection();
print('Band 1 projection:', b1proj);  // ee.Projection object

// Get scale (in meters) information from band 1.
var b1scale = image.select('B1').projection().nominalScale();
print('Band 1 scale:', b1scale);  // ee.Number

// Note that different bands can have different projections and scale.
var b8scale = image.select('B8').projection().nominalScale();
print('Band 8 scale:', b8scale);  // ee.Number

// Get a list of all metadata properties.
var properties = image.propertyNames();
print('Metadata properties:', properties);  // ee.List of metadata properties

// Get a specific metadata property.
var cloudiness = image.get('CLOUD_COVER');
print('CLOUD_COVER:', cloudiness);  // ee.Number

// Get the timestamp and convert it to a date.
var date = ee.Date(image.get('system:time_start'));
print('Timestamp:', date);  // ee.Date

Colab (Python)

import pprint

# Load an image.
image = ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20140318')

# All metadata.
print('All metadata:')
pprint.pprint(image.getInfo())

# Get information about the bands as a list.
band_names = image.bandNames()
print('Band names:', band_names.getInfo())  # ee.List of band names

# Get projection information from band 1.
b1_proj = image.select('B1').projection()
print('Band 1 projection:', b1_proj.getInfo())  # ee.Projection object

# Get scale (in meters) information from band 1.
b1_scale = image.select('B1').projection().nominalScale()
print('Band 1 scale:', b1_scale.getInfo())  # ee.Number

# Note that different bands can have different projections and scale.
b8_scale = image.select('B8').projection().nominalScale()
print('Band 8 scale:', b8_scale.getInfo())  # ee.Number

# Get a list of all metadata properties.
properties = image.propertyNames()
print('Metadata properties:',
      properties.getInfo())  # ee.List of metadata properties

# Get a specific metadata property.
cloudiness = image.get('CLOUD_COVER')
print('CLOUD_COVER:', cloudiness.getInfo())  # ee.Number

# Get the timestamp.
ee_date = ee.Date(image.get('system:time_start'))
print('Timestamp:', ee_date.getInfo())  # ee.Date

# Date objects transferred to the client are milliseconds since UNIX epoch;
# convert to human readable date with ee.Date.format().
print('Datetime:', ee_date.format().getInfo())  # ISO standard date string