Yunus Serhat Bıçakçı commited on
Commit
16ee35c
·
1 Parent(s): e99769f
Files changed (1) hide show
  1. pages/2_↔️_Comparision.py +48 -52
pages/2_↔️_Comparision.py CHANGED
@@ -18,80 +18,76 @@ st.sidebar.info(
18
  """
19
  )
20
 
21
- st.title("Comparision of Hate Tweets and Crime Rates")
22
  st.markdown(
23
  """
24
  These interactive maps illustrate a comparison of overall borough-level rates based on Twitter and London Metropolitan Police Service (MPS) data as of December 2022.
25
-
26
- In the first map shows the representation of hate tweets according to Twitter data, while the second map shows the representation of rates of all crimes according to MPS data.
27
-
28
  """
29
  )
30
 
 
31
 
32
- row1_col1, row1_col2, row1_col3 = st.columns([1, 1])
33
-
34
  with row1_col1:
35
-
36
- twitter = "https://raw.githubusercontent.com/yunusserhat/data/main/data/boroughs_count_df_2022_dec.geojson"
37
-
38
- m = leafmap.Map(center=[51.50, -0.1], zoom=10)
39
- m.add_data(
40
- twitter,
41
- column="count",
42
- scheme='Quantiles',
43
- cmap='YlOrRd',
44
- legend_title='Total Hate Tweet Number'
45
- )
46
-
47
-
48
  with row1_col2:
49
- mps = "https://raw.githubusercontent.com/yunusserhat/data/main/data/mps_hate_2022_dec_count.geojson"
50
-
51
- m2 = leafmap.Map(center=[51.50, -0.1], zoom=10)
52
- m2.add_data(
53
- mps,
54
- column="Hate_Crime_Number",
55
- scheme='Quantiles',
56
- cmap='YlOrRd',
57
- legend_title='Hate Crime Number'
58
- )
59
-
60
-
61
  with row1_col3:
62
- mps = "https://raw.githubusercontent.com/yunusserhat/data/main/data/mps2022dec_count.geojson"
63
-
64
- m2 = leafmap.Map(center=[51.50, -0.1], zoom=10)
65
- m2.add_data(
66
- mps,
67
- column="Crime_Number",
68
- scheme='Quantiles',
69
- cmap='YlOrRd',
70
- legend_title='Total Crime Number'
71
- )
72
-
73
-
74
- row2_col1, row2_col2, row2_col3 = st.columns([1, 1])
 
 
 
75
 
76
  with row2_col1:
77
- longitude = "-0.1"
78
- latitude = "51.50"
79
- zoomlevel = st.number_input("Zoom", 0, 20, 10)
80
- m.set_center(longitude, latitude, zoomlevel)
81
 
82
  with row2_col2:
83
  m2.set_center(longitude, latitude, zoomlevel)
84
 
85
  with row2_col3:
86
- m2.set_center(longitude, latitude, zoomlevel)
87
 
88
- row3_col1, row3_col2, row3_col3 = st.columns([1, 1])
89
 
90
  with row3_col1:
91
- m.to_streamlit()
92
 
93
  with row3_col2:
94
  m2.to_streamlit()
95
 
96
  with row3_col3:
97
- m2.to_streamlit()
 
18
  """
19
  )
20
 
21
+ st.title("Comparision of Hate Tweets, Hate Crime Rates and Total Crime Rates")
22
  st.markdown(
23
  """
24
  These interactive maps illustrate a comparison of overall borough-level rates based on Twitter and London Metropolitan Police Service (MPS) data as of December 2022.
25
+
26
+ In the first map shows the representation of hate tweets according to Twitter data, while the second and third maps shows the representation of rates of hate and all crimes according to MPS data.
 
27
  """
28
  )
29
 
30
+ row1_col1, row1_col2, row1_col3 = st.columns([1, 1, 1])
31
 
32
+ # Twitter Hate Tweets Map
 
33
  with row1_col1:
34
+ twitter = "https://raw.githubusercontent.com/yunusserhat/data/main/data/boroughs_count_df_2022_dec.geojson"
35
+ m1 = leafmap.Map(center=[51.50, -0.1], zoom=10)
36
+ m1.add_data(
37
+ twitter,
38
+ column="count",
39
+ scheme='Quantiles',
40
+ cmap='YlOrRd',
41
+ legend_title='Total Hate Tweet Number'
42
+ )
43
+
44
+ # MPS Hate Crimes Map
 
 
45
  with row1_col2:
46
+ mps_hate = "https://raw.githubusercontent.com/yunusserhat/data/main/data/mps_hate_2022_dec_count.geojson"
47
+ m2 = leafmap.Map(center=[51.50, -0.1], zoom=10)
48
+ m2.add_data(
49
+ mps_hate,
50
+ column="Hate_Crime_Number",
51
+ scheme='Quantiles',
52
+ cmap='YlOrRd',
53
+ legend_title='Hate Crime Number'
54
+ )
55
+
56
+ # MPS Total Crimes Map
 
57
  with row1_col3:
58
+ mps_total = "https://raw.githubusercontent.com/yunusserhat/data/main/data/mps2022dec_count.geojson"
59
+ m3 = leafmap.Map(center=[51.50, -0.1], zoom=10)
60
+ m3.add_data(
61
+ mps_total,
62
+ column="Crime_Number",
63
+ scheme='Quantiles',
64
+ cmap='YlOrRd',
65
+ legend_title='Total Crime Number'
66
+ )
67
+
68
+ row2_col1, row2_col2, row2_col3 = st.columns([1, 1, 1])
69
+
70
+ # Setting the zoom and center for each map
71
+ longitude = -0.1
72
+ latitude = 51.50
73
+ zoomlevel = st.number_input("Zoom", 0, 20, 10)
74
 
75
  with row2_col1:
76
+ m1.set_center(longitude, latitude, zoomlevel)
 
 
 
77
 
78
  with row2_col2:
79
  m2.set_center(longitude, latitude, zoomlevel)
80
 
81
  with row2_col3:
82
+ m3.set_center(longitude, latitude, zoomlevel)
83
 
84
+ row3_col1, row3_col2, row3_col3 = st.columns([1, 1, 1])
85
 
86
  with row3_col1:
87
+ m1.to_streamlit()
88
 
89
  with row3_col2:
90
  m2.to_streamlit()
91
 
92
  with row3_col3:
93
+ m3.to_streamlit()