0

I was asked to represent the land surface temp using google collab (I did using the rectangle), then I was asked again to adjust the map to be on the country boundaries I reused this code and the error appeared is AttributeError: 'Map' object has no attribute 'add_ee_layer'

My code:

import folium
import geemap
import ee

ee.Initialize()

roi = ee.Geometry.Polygon([
  [34.5825, 16.3765],
  [34.5825, 32.1610],
  [55.6667, 32.1610],
  [55.6667, 16.3765]
])

modis = ee.ImageCollection('MODIS/006/MOD11A1')

filtered = modis.filterBounds(roi).filterDate('2022-01-01', '2022-12-31')

lst = filtered.select('LST_Day_1km')

mean_temp = lst.mean()

Map= geemap.Map(location=[25, 45], zoom_start=6)

Map.add_ee_layer(mean_temp, {'min': 273, 'max': 323}, 'Land Surface Temperature')

palette = ['blue', 'limegreen', 'yellow', 'darkorange', 'red']

legend_html = '''
    <div style="position: fixed; 
                bottom: 50px; left: 50px; width: 150px; height: 120px; 
                background-color: white; z-index:9999; font-size:14px;
                border:1px solid grey; pointer-events:none;">
      <div style="padding: 10px;"><b>Legend</b></div>
      <div style="padding: 5px;">Min: 0°C</div>
      <div style="padding: 5px;">Max: 50°C</div>
    </div>
'''

Map.get_root().html.add_child(folium.Element(legend_html))
display(Map)
Razan
  • 1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Aug 13 '23 at 14:55

0 Answers0