0

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

https://code.earthengine.google.com/179ddb6096f79bd45c10930b0b6fbcca

closed as off-topic by PolyGeo May 26 at 1:17

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

1

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)
    ).rename('time');
  return kmg.addBands(time_band); 
}

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