I would like to know if there is any way to get the geometry and date data from a JSON object. I'm putting the coordinates and dates by hand but all my data comes from JSON files that have either the date and coordinates (https://0162ago2m5.execute-api.us-east-2.amazonaws.com/prod/life/133/)

Currently i'm using this code :

var geometry = ee.Geometry.Point([67.42467260724823, 21.057842149424154]);

var rrs = ee.ImageCollection("NASA/OCEANDATA/MODIS-Aqua/L3SMI")
  .filterDate('2018-1-04', '2018-1-05')
  .select('Rrs_488', 'Rrs_531', 'Rrs_547', 'Rrs_555')

rrs = rrs.toList(rrs.size());

var reduceR = function(image) {
  image = ee.Image(image);
  var reducedVal = image.reduceRegion({
    reducer: ee.Reducer.first(),
    geometry: geometry,
  return ee.Feature(geometry).set(reducedVal);

var mRrs=rrs.map(reduceR);
mRrs = ee.FeatureCollection(mRrs);

  collection: mRrs, 
  description: 'rrs', 
  fileNamePrefix: 'rrs', 
  fileFormat: 'CSV', 
  selectors: ['Rrs_488', 'Rrs_531', 'Rrs_547', 'Rrs_555']

1 Answer 1


If you would copy past the raw data into a ee.Dictionary, this would be possible:

var dict = ee.Dictionary(RAWJSONDATA);

// inspect the dictionary

Inspecting your file, you are interested in the 'pings', which have a lon and lat and a date property. You could rewrite them into useful GEE features using:

// make features from each element in the list
var feats = ee.FeatureCollection(ee.List(dict.get('pings')).map(function(feat){
  feat = ee.Dictionary(feat);
  var geom = ee.Geometry.Point([ee.Number.parse(feat.get('longitude')), ee.Number.parse(feat.get('latitude'))]);
  var getDate = ee.String(feat.get('datetime'));
  var systemDate = ee.Date.parse("dd MMM YYYY hh:mm:ss aa", getDate).millis();
  return ee.Feature(geom, ee.Dictionary(feat)).set('system:time_start', systemDate);
  // set the other properties of the dictionaries as properties to the collection
feats = ee.FeatureCollection(feats.setMulti(dict.remove(['pings'])));


Link code

  • Thanks a lot ! Sorry to abuse from your help but how do i call these data from de dictionaries in my code to get the relative reflectance based on lat long and date from the pings ?
    – user142308
    May 4, 2019 at 16:35

Your Answer

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