I am trying to add system:time_start as a band in my image, so that when I mosaic the image collection, I retain the time value of each pixel. I am doing this in Landsat data. However, when I add the metadata, it gets added as EPSG:4326 as opposed to EPSG:32644, which is the projection of a Landsat image.

enter image description here

I have attached the screenshot that shows time is added in a different projection. This is especially troublesome when I try to export the image--all I get is straight lines.

below is a reproducible code



If you want a new image band to have the same projection as an existing band, you can use the existing band as the base for the calculation. In the following example, the single-band base_band image will have the same projection (and extent and mask) as the band B1. You then can use the base_band to construct a time band that retains the same projection.

function timer(kmg) {
  var time_start = kmg.metadata('system:time_start');
  var base_band = kmg.select('B1').multiply(0);
  var time_band = base_band.add(
      time_start.divide(1000 * 60 * 60 * 24 * 365)
  return kmg.addBands(time_band); 

Not the answer you're looking for? Browse other questions tagged or ask your own question.