Google Earth Engine: pop-up when clicking on geometry/Feature

by YGS   Last Updated July 12, 2019 17:22 PM

This may be more of a JavaScript question than a GIS question. I'm adding feature points to a GEE map (https://code.earthengine.google.com/2d6c3146e5468cb9f14e10039ca22b59). My goal is to map point features from an asset table (which has associated data), and view those data when clicking on the features on the map.

Google Map API has an infowindow function (https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple) but I'm not sure if or how it can be incorporated into a GEE script.

Is it possible to have a pop-up bubble (info window) show up when a feature is clicked? I have looked through GEE guides but couldn't find any function already existing.

Here is an example script:

// Import DEM
var collection = 'WWF/HydroSHEDS/03VFDEM';
var band = 'b1';
var dataset = ee.Image(collection).select(band);
var elevationVis = {
  min: -50.0,
  max: 3000.0,
  gamma: 2.0,
};
// create point geometry (will call an asset in the real script)
var point = ee.Geometry.Point([-61.334, 15.416]);

Map.setCenter(-61.334, 15.416, 10);
Map.addLayer(dataset, elevationVis, collection);
Map.addLayer(point, {}, "acou");

// example from Google Map API
// should be placed earlier in the script but causes GEE to stop runing
var contentString = '<div id="content">'+
            '<p><b>Hello</b>'+
            '</div>';
var infowindow = new google.maps.InfoWindow({
          content: contentString
        });
var marker = new google.maps.Marker({
          position: point,
          map: map,
          title: 'Uluru (Ayers Rock)' });
        marker.addListener('click', function() {
          infowindow.open(map, marker);
        });


Related Questions


Google Earth plugin deprecated. Which alternatives?

Updated April 25, 2017 11:22 AM

Google Earth Engine filterdate ignored by plot?

Updated November 28, 2018 00:22 AM

Question for using chart

Updated September 18, 2018 20:22 PM