1

I want to build a timeseries chart for multiple points.

Is it possible to use ui.Chart.image.series and have different lines for different points?

They are not regions, so I don't think .seriesByRegion is appropriate.

When I feed in a feature collection of points, it seems to pull the MODIS data and stretch it along as if it were one location, not parse it out by location like I want.

Code below.

MODIS data for my time of interest

var terraCollection = ee.ImageCollection("MODIS/006/MOD10A1").select(['NDSI_Snow_Cover']).filter(ee.Filter.date('2019-11-01', '2020-05-01'))

Feature Collection of Points that I want to build a timeseries for

var points = ee.Geometry.MultiPoint(
    [[13.427963679755548, 60.28846585303612],
     [14.021225398505548, 60.87127944326994],
     [14.087143367255548, 60.08089287233658],
     [13.120346492255548, 60.02605006413671]]);

Current code for timeseries plot that seems to be merging all the points together:

var testChart = function(dataset) {return ui.Chart.image.series({
  imageCollection: dataset,
  region: points,
  }).setOptions({
  interpolateNulls: true,
  lineWidth: 1,
  pointSize: 3,
  title: 'NDSI over Time at a Single Location',
  vAxis: {title: 'NDSI'},
  hAxis: {title: 'Date', format: 'YYYY-MMM', gridlines: {count: 12}},
  series: {
    0: {color: '#FF0000'}, // Point 1
    1: {color: '#FFFF00'}, // Point 2
    2: {color: '#00FF00'}, // Point 3
    3: {color: '#0000FF'}, // Point 4
  }
})}

print(testChart(terraCollection))

1 Answer 1

1

You will need to use ui.Chart.image.seriesByRegion. Points are in the case also a region. However, this chart option will need a ee.FeatureCollection as input for the argument regions

var points = ee.FeatureCollection(
        [ee.Feature( ee.Geometry.Point([13.427963679755548, 60.28846585303612])),
        ee.Feature( ee.Geometry.Point([14.021225398505548, 60.87127944326994])),
        ee.Feature( ee.Geometry.Point([14.087143367255548, 60.08089287233658])),
        ee.Feature( ee.Geometry.Point([13.120346492255548, 60.02605006413671]))]);
     
var testChart = function(dataset) {
  return ui.Chart.image.seriesByRegion({
    imageCollection: dataset,
    regions: points,
    reducer: ee.Reducer.mean()
    })
// .setOptions({...}) // set the options you like
}

print(testChart(terraCollection))

Link code

2
  • Thank you! What is the reducer doing in this case since each point is treated independently? Jun 25, 2020 at 20:28
  • indeed, not that much for single points as geometry inputs.
    – Kuik
    Jun 26, 2020 at 8:31

Your Answer

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

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