UjjwalKGupta commited on
Commit
f8d91c2
1 Parent(s): 8ea27a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -118,6 +118,7 @@ def get_dem_slope_maps(buffer_ee_geometry):
118
  # Create a colormap
119
  colormap = cm.LinearColormap(colors=vis_params['palette'], vmin=vis_params['min'], vmax=vis_params['max'])
120
  dem_map.add_child(colormap)
 
121
 
122
  # Create the map for Slope
123
  slope_map = gee_folium.Map()
@@ -282,13 +283,14 @@ def format_fn(x):
282
  input_geometry_idx = st.selectbox("Select the geometry", input_gdf.index, format_func=format_fn)
283
  geometry_gdf = input_gdf[input_gdf.index == input_geometry_idx]
284
  buffer_geometry_gdf = geometry_gdf.copy()
285
- buffer_geometry_gdf["geometry"] = buffer_geometry_gdf["geometry"].buffer(buffer).difference(geometry_gdf.geometry.unary_union)
286
  check_valid_geometry(geometry_gdf)
287
 
288
  # Derived Inputs
289
  ee_geometry = ee.Geometry(geometry_gdf.to_crs(4326).geometry.item().__geo_interface__)
290
  ee_feature_collection = ee.FeatureCollection(ee_geometry)
291
  buffer_ee_geometry = ee.Geometry(buffer_geometry_gdf.to_crs(4326).geometry.item().__geo_interface__)
 
292
  buffer_ee_feature_collection = ee.FeatureCollection(buffer_ee_geometry)
293
 
294
  # visualize the geometry
@@ -466,12 +468,12 @@ if "result" in st.session_state:
466
 
467
  st.write("<h3><div style='text-align: center;'>DEM and Slope from SRTM at 30m resolution</div></h3>", unsafe_allow_html=True)
468
  dem_col, slope_col = st.columns(2)
469
- ee_geometry = ee.Geometry(geometry_gdf.to_crs(4326).geometry.item().__geo_interface__)
470
- dem_map, slope_map = get_dem_slope_maps(ee_geometry.buffer(buffer))
471
  # DEM Map
472
  dem_col.write("DEM Map")
473
  add_geometry_to_maps([dem_map])
474
  dem_map.to_streamlit()
 
475
  # Slope Map
476
  slope_col.write("Slope Map")
477
  slope_map.to_streamlit()
 
118
  # Create a colormap
119
  colormap = cm.LinearColormap(colors=vis_params['palette'], vmin=vis_params['min'], vmax=vis_params['max'])
120
  dem_map.add_child(colormap)
121
+ dem_map.addLayer(buffer_ee_geometry, )
122
 
123
  # Create the map for Slope
124
  slope_map = gee_folium.Map()
 
283
  input_geometry_idx = st.selectbox("Select the geometry", input_gdf.index, format_func=format_fn)
284
  geometry_gdf = input_gdf[input_gdf.index == input_geometry_idx]
285
  buffer_geometry_gdf = geometry_gdf.copy()
286
+ buffer_geometry_gdf["geometry"] = buffer_geometry_gdf["geometry"].buffer(buffer)
287
  check_valid_geometry(geometry_gdf)
288
 
289
  # Derived Inputs
290
  ee_geometry = ee.Geometry(geometry_gdf.to_crs(4326).geometry.item().__geo_interface__)
291
  ee_feature_collection = ee.FeatureCollection(ee_geometry)
292
  buffer_ee_geometry = ee.Geometry(buffer_geometry_gdf.to_crs(4326).geometry.item().__geo_interface__)
293
+ buffer_ee_geometry = buffer_ee_geometry.difference(ee_geometry)
294
  buffer_ee_feature_collection = ee.FeatureCollection(buffer_ee_geometry)
295
 
296
  # visualize the geometry
 
468
 
469
  st.write("<h3><div style='text-align: center;'>DEM and Slope from SRTM at 30m resolution</div></h3>", unsafe_allow_html=True)
470
  dem_col, slope_col = st.columns(2)
471
+ dem_map, slope_map = get_dem_slope_maps(ee.Geometry(buffer_geometry_gdf.to_crs(4326).geometry.item().__geo_interface__))
 
472
  # DEM Map
473
  dem_col.write("DEM Map")
474
  add_geometry_to_maps([dem_map])
475
  dem_map.to_streamlit()
476
+
477
  # Slope Map
478
  slope_col.write("Slope Map")
479
  slope_map.to_streamlit()