setLayer(name, mapIdPath, addOnTop) {
    this.removeLayer(name);
    var showLoadingFn = this.setAlert.bind(
        this, name, 'warning', 'Map layer "' + name + '" is loading.');

    var onError = (function(error) {
                    delete this.layerPaths[name];
                    this.setAlert(
                        name, 'danger',
                        'Map layer "' + name + '" failed to load.', error);
                  }).bind(this);

    var onDone = (function(data) {
                   // Create the layer.
                   const tileSource = new ee.layers.EarthEngineTileSource(data);
                   const layer =
                       new ee.layers.ImageOverlay(tileSource, {name: name});

                   // Add the layer to the map.
                   if (addOnTop) {
                     this.map.overlayMapTypes.push(layer);
                   } else {
                     this.map.overlayMapTypes.insertAt(0, layer);
                   }

                   // Hide and show the 'layer loading' alert as needed.
                   layer.addTileCallback(
                       (function(event) {
                         showLoadingFn(event.count + ' tiles remaining.');
                         if (event.count === 0) {
                           this.removeAlert(name);
                         }
                       }).bind(this));
                 }).bind(this);

    showLoadingFn();
    this.layerPaths[name] = mapIdPath;
    this.layerRequests[name] =
        exporter.App.handleRequest($.get(mapIdPath), onDone, onError);
  }
Sets the layer with the given name to the map returned by mapIdPath. The
layer is created if it doesn't already exist.
@param {string} name The name of the layer to set.
@param {string} mapIdPath The URL path at which to request
@param {boolean} addOnTop Whether to add this layer on top.