Google Earth Engine Tutorial: Beginners Guide 4 View Image Metadata
Credit: Youtube Channel “Terra Spatial, Guide on accessing and interpreting metadata information from satellite images in Google Earth Engine.”
You can see all the tutorials from here: Techgeo Academy.
Google Earth Engine Tutorial: Beginners Guide 4 – View Image Metadata
Understanding image metadata is crucial for effective remote sensing analysis in Google Earth Engine. Metadata provides essential information about satellite imagery including acquisition dates, cloud cover, sensor specifications, and processing details. This tutorial will guide you through accessing and interpreting image metadata.
What is Image Metadata?
Image metadata contains comprehensive information about satellite imagery stored in Google Earth Engine. This includes technical specifications, acquisition parameters, quality indicators, and processing history. Accessing metadata helps you make informed decisions about data selection and analysis.
Basic Metadata Access Methods
Method 1: Using getInfo() Function
// Load a Landsat 8 image
var image = ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_044034_20140318');
// Get all metadata
print('All metadata:', image.getInfo());
// Get specific metadata properties
print('Image ID:', image.get('system:id'));
print('Acquisition Date:', image.get('DATE_ACQUIRED'));
print('Cloud Cover:', image.get('CLOUD_COVER'));
Method 2: Using get() and getProperty()
// Access specific properties
var cloudCover = image.get('CLOUD_COVER');
var acquisitionDate = image.get('DATE_ACQUIRED');
var spacecraft = image.get('SPACECRAFT_ID');
print('Cloud Cover:', cloudCover);
print('Acquisition Date:', acquisitionDate);
print('Spacecraft:', spacecraft);
Method 3: Using propertyNames()
// Get all available property names
var propertyNames = image.propertyNames();
print('All Property Names:', propertyNames);
// Sort property names alphabetically
var sortedNames = propertyNames.sort();
print('Sorted Property Names:', sortedNames);
Working with Image Collections Metadata
// Load a collection
var collection = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
.filterDate('2020-01-01', '2020-12-31')
.filterBounds.geometry();
// Print collection information
print('Collection Size:', collection.size());
print('Collection Metadata:', collection.getInfo());
// Get metadata for first image
var firstImage = ee.Image(collection.first());
print('First Image Metadata:', firstImage.getInfo());
Advanced Metadata Extraction
Extracting Band Information
// Get band names and information
var bandNames = image.bandNames();
print('Band Names:', bandNames);
// Get specific band metadata
var bandInfo = image.select('SR_B4').getInfo();
print('Band 4 Information:', bandInfo);
System Properties vs Regular Properties
// System properties (start with 'system:')
print('System Time Start:', image.get('system:time_start'));
print('System Time End:', image.get('system:time_end'));
// Regular properties
print('Sensor ID:', image.get('SENSOR_ID'));
print('WRS Path:', image.get('WRS_PATH'));
Practical Examples
Filter Images by Metadata
// Filter collection by cloud cover
var lowCloudCollection = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
.filterDate('2020-01-01', '2020-12-31')
.filterMetadata('CLOUD_COVER', 'less_than', 20);
print('Low Cloud Images:', lowCloudCollection.size());
Create Metadata Summary Table
// Function to extract metadata
var extractMetadata = function(image) {
return ee.Feature(null, {
'image_id': image.get('system:id'),
'date': image.get('DATE_ACQUIRED'),
'cloud_cover': image.get('CLOUD_COVER'),
'spacecraft': image.get('SPACECRAFT_ID')
});
};
// Apply to collection
var metadataTable = collection.map(extractMetadata);
print('Metadata Table:', metadataTable);
Best Practices for Metadata Usage
- Always check cloud cover percentage before analysis
- Verify acquisition dates for temporal studies
- Use system timestamps for time-series analysis
- Filter collections based on quality indicators
- Document metadata parameters in your analysis
Common Metadata Properties
Property | Description | Example Value |
---|---|---|
CLOUD_COVER | Percentage of cloud cover | 15.5 |
DATE_ACQUIRED | Image acquisition date | 2020-06-15 |
SPACECRAFT_ID | Satellite identifier | LANDSAT_8 |
system:time_start | Start timestamp (milliseconds) | 1592179200000 |
Frequently Asked Questions
How do I access image metadata in Google Earth Engine?
You can access image metadata using the get()
method for specific properties or getInfo()
for complete metadata. For example: image.get('CLOUD_COVER')
or image.getInfo()
.
What are the most important metadata properties to check?
The most important metadata properties include cloud cover percentage, acquisition date, spacecraft ID, and processing level. These help determine image quality and suitability for analysis.
How can I filter images based on metadata?
Use the filterMetadata()
method with collections. For example: collection.filterMetadata('CLOUD_COVER', 'less_than', 20)
to filter for images with less than 20% cloud cover.
What’s the difference between system properties and regular properties?
System properties start with ‘system:’ prefix and include timestamps, IDs, and internal GEE metadata. Regular properties are dataset-specific attributes like cloud cover or sensor information.
How do I get a list of all available metadata properties?
Use the propertyNames()
method: image.propertyNames()
. This returns all available property names for the image.
Why is metadata important for remote sensing analysis?
Metadata provides crucial information about image quality, acquisition conditions, and temporal context. It helps in selecting appropriate images, understanding limitations, and ensuring accurate analysis results.
Can I extract metadata for multiple images at once?
Yes, you can map a metadata extraction function over collections. Use collection.map()
with a function that extracts desired metadata properties for each image.
How do I handle missing metadata values?
Use conditional statements or default values. For example: var cloudCover = image.get('CLOUD_COVER').getInfo() || 'Unknown'
to handle missing values gracefully.
What timestamp format does GEE use?
Google Earth Engine uses Unix timestamps in milliseconds for system time properties. You can convert these to readable dates using JavaScript Date objects or GEE’s date formatting functions.
How can I create metadata reports for my analysis?
Create FeatureCollections with metadata properties and export them as tables. Use the mapping approach shown in the metadata summary example to generate comprehensive reports of your image collections.