Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Begin sa boundary #26

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
0db8c79
Add datafile on stock demands
May 1, 2021
07f0020
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
May 1, 2021
188f414
Create environment.yml file
May 1, 2021
d3e752c
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
May 1, 2021
bdfa98b
Add new data file for buildings and creapp.py
May 1, 2021
92b9561
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
May 1, 2021
9ae844a
Create new py file with lasso tool
May 1, 2021
bf5e6a5
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
May 1, 2021
949f245
Delete old files and update format
May 2, 2021
e6c19d2
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
May 2, 2021
c76c930
Rename app file to suit deployment
May 13, 2021
b0f4a8d
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
May 13, 2021
408bf11
Create ets file and adjust namings
May 13, 2021
3ca8aee
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
May 13, 2021
7de54d9
Restore env.yml to try restore lasso tool
May 24, 2021
58293d7
Update readme
May 24, 2021
89aaee6
Add download option button to selected lasso data in csv form
May 24, 2021
fd8f7f2
Resolve merge conflicts in environment.yml
May 24, 2021
d38de8b
Update imported packages in app_ets
May 24, 2021
bac9e05
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
May 24, 2021
8d12ed0
Remove head incoming package duplicate
May 24, 2021
22b09ec
Remove requirements.txt and geopandas version
May 24, 2021
9ccc446
Update channels in yml file
May 24, 2021
07446c9
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
May 24, 2021
f365939
Add pandas to yaml
May 24, 2021
c7d5b9b
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
May 24, 2021
ced7244
Add requirements.txt and remove yaml
May 24, 2021
981d7b8
Test requirements.txt deployment
May 24, 2021
65863af
Remove importing of pandas bokeh as not needed
May 24, 2021
591c838
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
May 24, 2021
19f892f
Remove setting the toolbar location to right hand side
May 24, 2021
76e5488
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
May 24, 2021
c23f897
Change from downloading entire dataset to just lasso selected data
May 27, 2021
e23ebcf
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
May 27, 2021
e88d7f3
Fix download wrong files error
May 27, 2021
83ff00f
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
May 27, 2021
0c96157
Add Codema and SEAI logos to apps
May 27, 2021
808c170
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
May 27, 2021
9663338
Create new file to extract all sa info
May 27, 2021
b472dc8
Change geometry of polygons to centroids and adjust description
Jun 1, 2021
37df0a6
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
Jun 1, 2021
53e9db1
Remove git ignore as can't deploy app
Jun 1, 2021
d721c85
Just add single polygon datafile
Jun 1, 2021
77c6b47
Merge branch 'master' of https://github.com/codema-dev/large-dublin-c…
Jun 1, 2021
8802ada
Add zoom in/out tool capabilities
Jun 1, 2021
3136f33
Add commented out start to polygon outline on bokeh map
Jun 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions app_all_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
from geopandas import GeoDataFrame
import pandas as pd
import streamlit as st
from shapely.geometry import Polygon
from shapely.geometry import Polygon, MultiPoint
import numpy as np

from bokeh.plotting import figure
from bokeh.plotting import figure, show
from bokeh.tile_providers import CARTODBPOSITRON, get_provider
from bokeh.models import ColumnDataSource, CustomJS, tools
from bokeh.models import TableColumn, WidgetBox
Expand Down Expand Up @@ -45,15 +46,19 @@

map_data = gpd.GeoDataFrame(map_data)

poly = map_data[["geometry"]]

df = map_data[["GEOGID_left", "T1_1AGETT", "postcodes", "area", "pop-density-ppsqkm", "sa_resi_heat_emissions_TCO2", "sa_comm_elec_emissions_TCO2", "sa_comm_heat_emissions_TCO2", "sa_data_centre_elec_emissions_TCO2", "total_sa_emissions_TCO2", "total_sa_resi_emissions_TCO2", "total_sa_comm_emissions_TCO2", "geometry"]]

df = df.rename(columns={"GEOGID_left": "small_area_id", "T1_1AGETT": "population", "area": "area_m2"})

gdf = gpd.GeoDataFrame(poly)

df["centroid"] = df.centroid
df["x"] = df["centroid"].x
df["y"] = df["centroid"].y

df = df[["GEOGID_left", "T1_1AGETT", "postcodes", "area", "pop-density-ppsqkm", "sa_resi_heat_emissions_TCO2", "sa_comm_elec_emissions_TCO2", "sa_comm_heat_emissions_TCO2", "sa_data_centre_elec_emissions_TCO2", "total_sa_emissions_TCO2", "total_sa_resi_emissions_TCO2", "total_sa_comm_emissions_TCO2", "x", "y"]]

df = df.rename(columns={"GEOGID_left": "small_area_id", "T1_1AGETT": "population", "area": "area_m2"})
df = df[["small_area_id", "population", "postcodes", "area_m2", "pop-density-ppsqkm", "sa_resi_heat_emissions_TCO2", "sa_comm_elec_emissions_TCO2", "sa_comm_heat_emissions_TCO2", "sa_data_centre_elec_emissions_TCO2", "total_sa_emissions_TCO2", "total_sa_resi_emissions_TCO2", "total_sa_comm_emissions_TCO2", "x", "y"]]

df = df.drop_duplicates('small_area_id')

Expand Down Expand Up @@ -120,14 +125,20 @@ def get_table_download_link(df):

return href

plot = figure(x_axis_type="mercator", y_axis_type="mercator", tools="pan, box_zoom, wheel_zoom, lasso_select")
plot = figure(x_axis_type="mercator", y_axis_type="mercator", tools="pan, zoom_in, zoom_out, box_zoom, wheel_zoom, lasso_select")


plot.xaxis.axis_label = 'longitude'
plot.yaxis.axis_label = 'latitude'

tile_provider = get_provider(CARTODBPOSITRON)

plot.add_tile(tile_provider)

# Return to this at a later stage to try add SA boundary to bokeh map
#poly_list = [list(gdf.geometry.exterior[row_id].coords) for row_id in range(gdf.shape[0])]
#plot.patches(poly_list, color=["firebrick"], alpha=[0.8], line_width=2)

plot.circle("x", "y", fill_alpha=0.5, size=5, source=cds_lasso)
with col2:
result_lasso = streamlit_bokeh_events(
Expand Down