giswqs commited on
Commit
8e8dd30
·
1 Parent(s): 8c57749

Added 3D view

Browse files
Files changed (3) hide show
  1. app.py +1 -1
  2. apps/housing.py +22 -8
  3. multiapp.py +1 -1
app.py CHANGED
@@ -10,7 +10,7 @@ apps = MultiApp()
10
  # Add all your application here
11
 
12
  apps.add_app("Real Estate", housing.app)
13
- apps.add_app("pydeck", deck.app)
14
  apps.add_app("Home", home.app)
15
 
16
  # The main app
 
10
  # Add all your application here
11
 
12
  apps.add_app("Real Estate", housing.app)
13
+ apps.add_app("Pyeck", deck.app)
14
  apps.add_app("Home", home.app)
15
 
16
  # The main app
apps/housing.py CHANGED
@@ -305,18 +305,27 @@ def app():
305
  except:
306
  st.warning("No description available for selected attribute")
307
 
308
- row2_col1, row2_col2, row2_col3, row2_col4 = st.columns([1, 1, 2, 2])
 
 
309
 
310
  with row2_col1:
311
  palette = st.selectbox("Color palette", cm.list_colormaps(), index=2)
312
  with row2_col2:
313
  n_colors = st.slider("Number of colors", min_value=2, max_value=20, value=8)
314
  with row2_col3:
315
- show_colormaps = st.checkbox("Preview all color palettes")
316
- if show_colormaps:
317
- st.write(cm.plot_colormaps(return_fig=True))
318
- with row2_col4:
319
  show_nodata = st.checkbox("Show nodata areas", value=True)
 
 
 
 
 
 
 
 
 
 
 
320
 
321
  gdf = join_attributes(gdf, inventory_df, scale.lower())
322
  gdf_null = select_null(gdf, selected_col)
@@ -351,9 +360,10 @@ def app():
351
  opacity=0.5,
352
  stroked=True,
353
  filled=True,
354
- extruded=False,
355
  wireframe=True,
356
- # get_elevation="properties.ALAND/100000",
 
357
  # get_fill_color="color",
358
  get_fill_color=color_exp,
359
  get_line_color=[0, 0, 0],
@@ -418,11 +428,15 @@ def app():
418
  font_size=10,
419
  )
420
  )
421
- row4_col1, row4_col2, _ = st.columns([1, 2, 3])
422
  with row4_col1:
423
  show_data = st.checkbox("Show raw data")
424
  with row4_col2:
425
  show_cols = st.multiselect("Select columns", data_cols)
 
 
 
 
426
  if show_data:
427
  if scale == "National":
428
  st.dataframe(gdf[["NAME", "GEOID"] + show_cols])
 
305
  except:
306
  st.warning("No description available for selected attribute")
307
 
308
+ row2_col1, row2_col2, row2_col3, row2_col4, row2_col5, row2_col6 = st.columns(
309
+ [0.6, 0.68, 0.7, 0.7, 1.5, 0.8]
310
+ )
311
 
312
  with row2_col1:
313
  palette = st.selectbox("Color palette", cm.list_colormaps(), index=2)
314
  with row2_col2:
315
  n_colors = st.slider("Number of colors", min_value=2, max_value=20, value=8)
316
  with row2_col3:
 
 
 
 
317
  show_nodata = st.checkbox("Show nodata areas", value=True)
318
+ with row2_col4:
319
+ show_3d = st.checkbox("Show 3D view", value=False)
320
+ with row2_col5:
321
+ if show_3d:
322
+ elev_scale = st.slider(
323
+ "Elevation scale", min_value=1, max_value=1000000, value=1, step=10
324
+ )
325
+ with row2_col6:
326
+ st.info("Press Ctrl and move the left mouse button.")
327
+ else:
328
+ elev_scale = 1
329
 
330
  gdf = join_attributes(gdf, inventory_df, scale.lower())
331
  gdf_null = select_null(gdf, selected_col)
 
360
  opacity=0.5,
361
  stroked=True,
362
  filled=True,
363
+ extruded=show_3d,
364
  wireframe=True,
365
+ get_elevation=f"{selected_col}",
366
+ elevation_scale=elev_scale,
367
  # get_fill_color="color",
368
  get_fill_color=color_exp,
369
  get_line_color=[0, 0, 0],
 
428
  font_size=10,
429
  )
430
  )
431
+ row4_col1, row4_col2, row4_col3 = st.columns([1, 2, 3])
432
  with row4_col1:
433
  show_data = st.checkbox("Show raw data")
434
  with row4_col2:
435
  show_cols = st.multiselect("Select columns", data_cols)
436
+ with row4_col3:
437
+ show_colormaps = st.checkbox("Preview all color palettes")
438
+ if show_colormaps:
439
+ st.write(cm.plot_colormaps(return_fig=True))
440
  if show_data:
441
  if scale == "National":
442
  st.dataframe(gdf[["NAME", "GEOID"] + show_cols])
multiapp.py CHANGED
@@ -74,6 +74,6 @@ class MultiApp:
74
  st.sidebar.info(
75
  """
76
  This app is maintained by Qiusheng Wu. You can learn more about me at
77
- [wetlands.io](https://wetlands.io) or [GitHub.com](https://github.com/giswqs).
78
  """
79
  )
 
74
  st.sidebar.info(
75
  """
76
  This app is maintained by Qiusheng Wu. You can learn more about me at
77
+ [wetlands.io](https://wetlands.io) | [GitHub](https://github.com/giswqs) | [Twitter](https://twitter.com/giswqs) | [YouTube](https://www.youtube.com/c/QiushengWu).
78
  """
79
  )