3

I have been struggling to add a timeline tool to a time-lapse video I put together on GEE... The last part of my code is:

var polygon = ee.Geometry.Rectangle([-XX,-XX,-XX,-XX]); //xMin, yMin, xMax, yMax.

var videoArgs = {
  collection: collection,
  description: 'VideoExample',
  dimensions: 600,
  framesPerSecond: 10,
  region: polygon
};

print(collection.getVideoThumbURL(videoArgs));

How would it be possible to add a timeline tool to the video representing the changes over time for my collection? How can I pass the date of each image to the timeline tool and then to the video?

1

1 Answer 1

5

To add timestamps to timelapse, you need to add text overlays to each frame using the example from here. It is based on gena's textoverlay package.

To import that package use :var text = require('users/gena/packages:text').

Then create a function that adds a property called label to each image in your stack with the timestamp of your choice. Finally, print/export your videoThumbURL as usual.

Link to complete working example is here. The base visualization was obtained from the Image Visualization documentation. The result of the working example is provided below.

enter image description here

The text is pixelated since Earth Engine doesn't inherently support text elements in its Map environment. So the package is a workaround to create image elements that look like text.

1
  • 1
    Awesome... thanks for your help kkrao ! ... I made it work ... now I am wondering how could I do the same strategy to include the legend in the video as well... I understand that you pass the time as a dynamic string, but how can I do the same for a Legend?. I have been able to include a Legend on the console... var legend = ui.Panel({style:{position: 'bottom-left',padding:'8px 15px'}}); var legendTitle = ui.Label({value:'Temperature-2m (Celsius).......etc... I was able to add the panels to the console but how do I visualize it in the video as an annotation?
    – Rodrigo
    Jun 27, 2020 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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