Mapping over an image collection (NO2 in this case), for .clip, is simple:

var NO2NL=NO2.map(function(im){ 
   return im.clip(NL);

Replacing .clip with .resample(bilinear) works too, however using .reproject(scale=1000) always produces an error: Variable must be declared with "var": scale. Any idea how I can reproject over an image collection?

Entire script for reference:

//Set variables

var countries = ee.FeatureCollection("FAO/GAUL/2015/level0");
var NL = countries.filterMetadata('ADM0_NAME', 'equals', 'Netherlands');
var start_period = ee.Date('2018-07-01');
var end_period = ee.Date(new Date().getTime());

var NO2 = ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_NO2')
    .filterDate(start_period, end_period);
var NO2NL=NO2.map(function(im){ 
   return im.clip(NL);


// Date slider parameters
ee.Dictionary({start: start_period, end: end_period})

function renderSlider(dates) {
  var slider = ui.DateSlider({
    start: dates.start.value, 
    end: dates.end.value, 
    period: 14, // Every 14 days
    onChange: renderDateRange,
    style: {
    position: 'top-left',

function renderDateRange(dateRange) {
  var image = NO2NL
    .filterDate(dateRange.start(), dateRange.end())

 // Visual parameters and mapping
  var vis = {min: 0, max: 0.0001, palette: [
    'black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red']};
  var layer = ui.Map.Layer(image, vis, 'Tropospheric NO2');
Map.setCenter(5.5, 52.2, 7.5);

Eventually I hope that the time slider shows only dates on which the data is available. I also want to use ECMWF data for wind speed and join the datasets so that only days with wind speed <10kph are shown!

1 Answer 1


You need to also set crs. Then in Earth Engine javascript you need to define all arguments up to the one you want to change, or use a dictionary. So this would work:

return im.reproject({crs:'EPSG:4326', scale:1000});

as well as this:

return im.reproject('EPSG:4326', null, 1000);
  • Thanks, this worked well! I like to list all variables so did not use a dictionary. I am trying to visualize more than one layer/ image collection when sliding the time slider. Do you think this is possible, based on the above script? The renderDateRange function can only be called once and only one image collection can be applied to the 'image' variable above...
    – Olivier
    Feb 8, 2021 at 10:58

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.