diff --git a/analysis/database/accident_copy.sql b/analysis/database/accident_copy.sql index 2e23c7b..559746c 100644 --- a/analysis/database/accident_copy.sql +++ b/analysis/database/accident_copy.sql @@ -3,6 +3,7 @@ drop table if exists accident_copy; create table accident_copy as select * from accidents; 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' where accidentseveritycategory='as4'; diff --git a/analysis/database/mivcount_copy b/analysis/database/assertions.sql similarity index 100% rename from analysis/database/mivcount_copy rename to analysis/database/assertions.sql diff --git a/analysis/database/fbcount_copy.sql b/analysis/database/fbcount_copy.sql index 11065e7..069c346 100644 --- a/analysis/database/fbcount_copy.sql +++ b/analysis/database/fbcount_copy.sql @@ -6,10 +6,12 @@ CREATE TABLE fbcount_copy AS ALTER TABLE fbcount_copy ADD fuss_total INTEGER; UPDATE fbcount_copy SET fuss_total = fuss_in + fuss_out; + + ALTER TABLE fbcount_copy DROP COLUMN IF EXISTS fuss_in, DROP COLUMN IF EXISTS fuss_out, - ADD PRIMARY KEY (id); + ADD FOREIGN KEY (id) REFERENCES footbikecount; ALTER TABLE fbcount_copy ADD velo_total INTEGER; UPDATE fbcount_copy SET velo_total = velo_in + velo_out; diff --git a/analysis/map.py b/analysis/map.py index 4edccc1..6d7794e 100644 --- a/analysis/map.py +++ b/analysis/map.py @@ -271,7 +271,6 @@ def generate_contrasting_gradient(num_colors): return gradient - if __name__ == "__main__": time_map = folium.Map( location=zurich_coordinates, @@ -299,5 +298,35 @@ if __name__ == "__main__": create_heat_map_toggle(toggle_map) ## Save Maps ============================================================================================ - save_map_as_html(toggle_map, "heat_map_toggle") + save_map_as_html(toggle_map, "html/heat_map_toggle") 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")