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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[[["\u003cp\u003eThis guide demonstrates how to access and print image metadata in Earth Engine, including band names, projection details, properties, and timestamps.\u003c/p\u003e\n"],["\u003cp\u003eUsers can retrieve specific metadata elements programmatically using methods like \u003ccode\u003ebandNames()\u003c/code\u003e, \u003ccode\u003eprojection()\u003c/code\u003e, \u003ccode\u003enominalScale()\u003c/code\u003e, \u003ccode\u003epropertyNames()\u003c/code\u003e, and \u003ccode\u003eget()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eCode examples are provided in both JavaScript and Python, showcasing how to obtain metadata such as band information, projection details, scale, metadata properties, cloud cover, and ingestion timestamps.\u003c/p\u003e\n"],["\u003cp\u003eDifferent bands within an image may have varying projections and scales, highlighting the importance of accessing band-specific metadata.\u003c/p\u003e\n"],["\u003cp\u003eThe guide utilizes an example Landsat 8 image to illustrate the metadata retrieval process, enabling users to adapt the techniques for their specific datasets.\u003c/p\u003e\n"]]],["The content demonstrates how to access and display image metadata using Earth Engine's JavaScript and Python APIs. Key actions include loading an image, printing all its metadata, and extracting specific information such as band names, projection details, and band scales. It also showcases retrieving metadata properties like cloud cover and version number, alongside converting timestamps to human-readable dates, using the `ee.Date` function and formatting it with `.format()`.\n"],null,["# Image Information and Metadata\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|\n| [Run in Google Colab](https://colab.research.google.com/github/google/earthengine-community/blob/master/guides/linked/generated/image_info.ipynb) | [View source on GitHub](https://github.com/google/earthengine-community/blob/master/guides/linked/generated/image_info.ipynb) |\n\nPrint image objects to explore band names, projection information, properties, and other\nmetadata. The following examples demonstrate printing the entire set of image metadata\nas well as requesting specific metadata elements programmatically.\n\nGetting metadata\n----------------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Load an image.\nvar image = ee.Image('LANDSAT/LC08/C02/T1/LC08_044034_20140318');\n\n// Display all metadata.\nprint('All metadata:', image);\n\n// Get information about the bands as a list.\nvar bandNames = image.bandNames();\nprint('Band names:', bandNames); // ee.List of band names\n\n// Get projection information from band 1.\nvar b1proj = image.select('B1').projection();\nprint('Band 1 projection:', b1proj); // ee.Projection object\n\n// Get scale (in meters) information from band 1.\nvar b1scale = image.select('B1').projection().nominalScale();\nprint('Band 1 scale:', b1scale); // ee.Number\n\n// Note that different bands can have different projections and scale.\nvar b8scale = image.select('B8').projection().nominalScale();\nprint('Band 8 scale:', b8scale); // ee.Number\n\n// Get a list of all metadata properties.\nvar properties = image.propertyNames();\nprint('Metadata properties:', properties); // ee.List of metadata properties\n\n// Get a specific metadata property.\nvar cloudiness = image.get('CLOUD_COVER');\nprint('CLOUD_COVER:', cloudiness); // ee.Number\n\n// Get version number (ingestion timestamp as microseconds since Unix epoch).\nvar version = image.get('system:version');\nprint('Version:', version); // ee.Number\nprint('Version (as ingestion date):',\n ee.Date(ee.Number(version).divide(1000))); // ee.Date\n\n// Get the timestamp and convert it to a date.\nvar date = ee.Date(image.get('system:time_start'));\nprint('Timestamp:', date); // ee.Date\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# Load an image.\nimage = ee.Image('LANDSAT/LC08/C02/T1/LC08_044034_20140318')\n\n# All metadata.\ndisplay('All metadata:', image)\n\n# Get information about the bands as a list.\nband_names = image.bandNames()\ndisplay('Band names:', band_names) # ee.List of band names\n\n# Get projection information from band 1.\nb1_proj = image.select('B1').projection()\ndisplay('Band 1 projection:', b1_proj) # ee.Projection object\n\n# Get scale (in meters) information from band 1.\nb1_scale = image.select('B1').projection().nominalScale()\ndisplay('Band 1 scale:', b1_scale) # ee.Number\n\n# Note that different bands can have different projections and scale.\nb8_scale = image.select('B8').projection().nominalScale()\ndisplay('Band 8 scale:', b8_scale) # ee.Number\n\n# Get a list of all metadata properties.\nproperties = image.propertyNames()\ndisplay('Metadata properties:', properties) # ee.List of metadata properties\n\n# Get a specific metadata property.\ncloudiness = image.get('CLOUD_COVER')\ndisplay('CLOUD_COVER:', cloudiness) # ee.Number\n\n# Get version number (ingestion timestamp as microseconds since Unix epoch).\nversion = image.get('system:version')\ndisplay('Version:', version) # ee.Number\ndisplay(\n 'Version (as ingestion date):',\n ee.Date(ee.Number(version).divide(1000)).format(),\n) # ee.Date\n\n# Get the timestamp.\nee_date = ee.Date(image.get('system:time_start'))\ndisplay('Timestamp:', ee_date) # ee.Date\n\n# Date objects transferred to the client are milliseconds since UNIX epoch;\n# convert to human readable date with ee.Date.format().\ndisplay('Datetime:', ee_date.format()) # ISO standard date string\n```"]]