UjjwalKGupta commited on
Commit
577fc3d
1 Parent(s): 518e635

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -5
app.py CHANGED
@@ -157,12 +157,20 @@ def get_dem_slope_maps(buffer_ee_geometry):
157
  vis_params = {"min": min_value, "max": max_value, "palette": ["blue", "green", "yellow", "red"]}
158
  dem_map.addLayer(contours, vis_params, "Contours")
159
  # Create a colormap
160
- #colormap = cm.LinearColormap(colors=vis_params["palette"], vmin=vis_params["min"], vmax=vis_params["max"])
161
  #dem_map.add_child(colormap)
162
- dem_map.add_colormap(width=4,vmin=min_value, vmax=max_value, palette=vis_params['palette'],
163
- vis_params=vis_params, label='Elevation(m)',
164
- discrete=False, tick_size=10, bg_color='white',
165
- transparent=True, orientation='vertical')
 
 
 
 
 
 
 
 
166
 
167
  # Create the map for Slope
168
  slope_map = gee_folium.Map()
 
157
  vis_params = {"min": min_value, "max": max_value, "palette": ["blue", "green", "yellow", "red"]}
158
  dem_map.addLayer(contours, vis_params, "Contours")
159
  # Create a colormap
160
+ colormap = cm.LinearColormap(colors=vis_params["palette"], vmin=vis_params["min"], vmax=vis_params["max"])
161
  #dem_map.add_child(colormap)
162
+ #dem_map.add_colormap(width=4,vmin=min_value, vmax=max_value, palette=vis_params['palette'],
163
+ # vis_params=vis_params, label='Elevation(m)',
164
+ # discrete=False, tick_size=10, bg_color='white',
165
+ # transparent=True, orientation='horizontal')
166
+ tick_size = int((max_value-min_value)/4)
167
+ dem_map.add_legend(title="Elevation (m)",
168
+ legend_dict={'{}-{} m'.format(min_value, min_value+tick_size): cmap(min_value),
169
+ '{}-{} m'.format(min_value+tick_size, min_value+2*tick_size): cmap(min_value+tick_size),
170
+ '{}-{} m'.format(min_value+2*tick_size, min_value+3*tick_size): cmap(min_value+2*tick_size),
171
+ '{}-{} m'.format(min_value+3*tick_size, max_value): cmap(min_value)},
172
+ position='bottomright',
173
+ font_size=12)
174
 
175
  # Create the map for Slope
176
  slope_map = gee_folium.Map()