ee.Image.pixelLonLat

  • The ee.Image.pixelLonLat() method creates an image with 'longitude' and 'latitude' bands representing the coordinates at each pixel.

  • This method does not require any arguments.

  • Examples in both JavaScript and Python demonstrate how to use this method to calculate and visualize UTM zones.

Creates an image with two bands named 'longitude' and 'latitude', containing the longitude and latitude at each pixel, in degrees.

UsageReturns
ee.Image.pixelLonLat()Image

No arguments.

Examples

Code Editor (JavaScript)

// https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system
var longitude = ee.Image.pixelLonLat().select('longitude');
var utmZones = longitude.add(180).divide(6).int();
Map.addLayer(utmZones, {min:0, max: 60}, 'UTM zones');

Python setup

See the Python Environment page for information on the Python API and using geemap for interactive development.

import ee
import geemap.core as geemap

Colab (Python)

# https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system
longitude = ee.Image.pixelLonLat().select('longitude')
utm_zones = longitude.add(180).divide(6).int()
m = geemap.Map()
m.add_layer(utm_zones, {'min': 0, 'max': 60}, 'UTM zones')
m