Merge remote-tracking branch 'origin/sebl' into sebl
# Conflicts: # analysis/map.py
This commit is contained in:
commit
06e3897b9c
@ -3,6 +3,7 @@ drop table if exists accident_copy;
|
|||||||
create table accident_copy as
|
create table accident_copy as
|
||||||
select * from accidents;
|
select * from accidents;
|
||||||
alter table accident_copy add severity varchar;
|
alter table accident_copy add severity varchar;
|
||||||
|
alter table accident_copy add foreign key (accidentuid) references accidents;
|
||||||
update accident_copy set severity = 'Accident with property damage'
|
update accident_copy set severity = 'Accident with property damage'
|
||||||
where accidentseveritycategory='as4';
|
where accidentseveritycategory='as4';
|
||||||
|
|
||||||
|
|||||||
@ -6,10 +6,12 @@ CREATE TABLE fbcount_copy AS
|
|||||||
ALTER TABLE fbcount_copy ADD fuss_total INTEGER;
|
ALTER TABLE fbcount_copy ADD fuss_total INTEGER;
|
||||||
UPDATE fbcount_copy SET fuss_total = fuss_in + fuss_out;
|
UPDATE fbcount_copy SET fuss_total = fuss_in + fuss_out;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE fbcount_copy
|
ALTER TABLE fbcount_copy
|
||||||
DROP COLUMN IF EXISTS fuss_in,
|
DROP COLUMN IF EXISTS fuss_in,
|
||||||
DROP COLUMN IF EXISTS fuss_out,
|
DROP COLUMN IF EXISTS fuss_out,
|
||||||
ADD PRIMARY KEY (id);
|
ADD FOREIGN KEY (id) REFERENCES footbikecount;
|
||||||
|
|
||||||
ALTER TABLE fbcount_copy ADD velo_total INTEGER;
|
ALTER TABLE fbcount_copy ADD velo_total INTEGER;
|
||||||
UPDATE fbcount_copy SET velo_total = velo_in + velo_out;
|
UPDATE fbcount_copy SET velo_total = velo_in + velo_out;
|
||||||
|
|||||||
@ -24,11 +24,12 @@ formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(messag
|
|||||||
stream_handler.setFormatter(formatter)
|
stream_handler.setFormatter(formatter)
|
||||||
logger.addHandler(stream_handler)
|
logger.addHandler(stream_handler)
|
||||||
|
|
||||||
|
|
||||||
accidents_filepath = "../src/datasets/integrated/Accidents.geojson"
|
accidents_filepath = "../src/datasets/integrated/Accidents.geojson"
|
||||||
signaled_speeds_filepath = "../src/datasets/integrated/signaled_speeds.geojson.geojson"
|
signaled_speeds_filepath = "../src/datasets/integrated/signaled_speeds.geojson.geojson"
|
||||||
|
|
||||||
# Map centered around zurich
|
# Map centered around zurich
|
||||||
zurich_coordinates = [47.368650, 8.539183]
|
zurich_coordinates = [47.368650, 8.539183]
|
||||||
fixed_map_zurich_original_coords = folium.Map(
|
fixed_map_zurich_original_coords = folium.Map(
|
||||||
location=zurich_coordinates,
|
location=zurich_coordinates,
|
||||||
zoom_start=13,
|
zoom_start=13,
|
||||||
@ -60,6 +61,7 @@ color_dict = {
|
|||||||
|
|
||||||
# Create Maps =========================================================================================================
|
# Create Maps =========================================================================================================
|
||||||
def create_heat_map_with_time(folium_map):
|
def create_heat_map_with_time(folium_map):
|
||||||
|
|
||||||
# Process heat map data
|
# Process heat map data
|
||||||
heat_view_data = get_view("heat")
|
heat_view_data = get_view("heat")
|
||||||
heat_df = gpd.GeoDataFrame(heat_view_data, columns=['latitude', 'longitude', 'year'])
|
heat_df = gpd.GeoDataFrame(heat_view_data, columns=['latitude', 'longitude', 'year'])
|
||||||
@ -358,3 +360,33 @@ if __name__ == "__main__":
|
|||||||
## Save Maps ============================================================================================
|
## Save Maps ============================================================================================
|
||||||
save_map_as_html(toggle_map, "html/heat_map_toggle")
|
save_map_as_html(toggle_map, "html/heat_map_toggle")
|
||||||
save_map_as_html(time_map, "html/heat_map_time")
|
save_map_as_html(time_map, "html/heat_map_time")
|
||||||
|
|
||||||
|
## Create Maps with fixed center=============================================================================
|
||||||
|
time_map_fix = folium.Map(
|
||||||
|
location=zurich_coordinates,
|
||||||
|
zoom_start=13,
|
||||||
|
zoom_control=True,
|
||||||
|
dragging=False,
|
||||||
|
scrollWheelZoom=True,
|
||||||
|
doubleClickZoom=False,
|
||||||
|
tiles="cartodb positron"
|
||||||
|
)
|
||||||
|
|
||||||
|
toggle_map_fix = folium.Map(
|
||||||
|
location=zurich_coordinates,
|
||||||
|
zoom_start=13,
|
||||||
|
zoom_control=True,
|
||||||
|
dragging=False,
|
||||||
|
scrollWheelZoom=True,
|
||||||
|
doubleClickZoom=False,
|
||||||
|
tiles="cartodb positron"
|
||||||
|
)
|
||||||
|
|
||||||
|
#setup_views()
|
||||||
|
|
||||||
|
create_heat_map_with_time(time_map_fix)
|
||||||
|
create_heat_map_toggle(toggle_map_fix)
|
||||||
|
|
||||||
|
## Save Maps ============================================================================================
|
||||||
|
save_map_as_html(toggle_map_fix, "html/heat_map_toggle_fix")
|
||||||
|
save_map_as_html(time_map_fix, "html/heat_map_time_fix")
|
||||||
|
|||||||
Reference in New Issue
Block a user