Juansecal commited on
Commit
5ab6037
·
1 Parent(s): 95f57aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -18
app.py CHANGED
@@ -113,27 +113,14 @@ def main():
113
  gdf = create_geodataframe(longitude, latitude)
114
  gdf['geometry'] = gdf['geometry'].to_crs(epsg=4326)
115
  st.write(gdf)
116
- #polygon_name1 = gdf.within(st.session_state.polygons["Polygon1"])
117
- #st.write(polygon_name1[polygon_name1.isna()])
118
- #polygon_name2 = gdf.within(st.session_state.polygons["Polygon2"])
119
  polygon_name1=gpd.sjoin(gdf, st.session_state.polygons["Polygon1"], how="left", predicate="within")['index_right']
120
- st.write(polygon_name1)
121
  polygon_name2=gpd.sjoin(gdf, st.session_state.polygons["Polygon2"], how="left", predicate="within")['index_right']
122
- st.write(polygon_name2)
123
 
124
  polygon_name3=gpd.sjoin(gdf, st.session_state.polygons["Polygon3"], how="left", predicate="within")['index_right']
125
- st.write(polygon_name3)
126
-
127
- #st.write(polygon_name2)
128
- #st.write(np.isnan(polygon_name2[0]))
129
-
130
- #st.write(polygon_name2)
131
- #latitude=48.885805
132
- # longitude=2.366191
133
- #polygon_name3 = gdf.within(st.session_state.polygons["Polygon3"])
134
- # folium.GeoJson(risk_zones).add_to(m)
135
- #gdf=policies_geo[1:1]
136
- #m =folium.Map(location = [longitude, latitude], zoom_start = 10)
137
  m=folium.Map([gdf['geometry'].y, gdf['geometry'].x],zoom_start = 15)
138
  folium.CircleMarker([gdf['geometry'].y, gdf['geometry'].x], radius=1, color='red').add_to(m)
139
  #folium.GeoJson(st.session_state.polygons["Polygon2"], color='blue').add_to(m)
@@ -147,7 +134,7 @@ def main():
147
  folium.GeoJson(st.session_state.polygons["Polygon3"][st.session_state.polygons["Polygon3"].index==polygon_name3[0]],color='orange').add_to(m)
148
 
149
  point = Point(longitude, latitude)
150
- st_folium(m, width=700, height=500)
151
 
152
 
153
  if not np.isnan(polygon_name1[0]):
@@ -163,6 +150,8 @@ def main():
163
  st.markdown(f"Risk check OK", unsafe_allow_html=True)
164
 
165
 
 
 
166
  # Run the app
167
  if __name__ == "__main__":
168
  main()
 
113
  gdf = create_geodataframe(longitude, latitude)
114
  gdf['geometry'] = gdf['geometry'].to_crs(epsg=4326)
115
  st.write(gdf)
116
+
 
 
117
  polygon_name1=gpd.sjoin(gdf, st.session_state.polygons["Polygon1"], how="left", predicate="within")['index_right']
118
+
119
  polygon_name2=gpd.sjoin(gdf, st.session_state.polygons["Polygon2"], how="left", predicate="within")['index_right']
 
120
 
121
  polygon_name3=gpd.sjoin(gdf, st.session_state.polygons["Polygon3"], how="left", predicate="within")['index_right']
122
+
123
+
 
 
 
 
 
 
 
 
 
 
124
  m=folium.Map([gdf['geometry'].y, gdf['geometry'].x],zoom_start = 15)
125
  folium.CircleMarker([gdf['geometry'].y, gdf['geometry'].x], radius=1, color='red').add_to(m)
126
  #folium.GeoJson(st.session_state.polygons["Polygon2"], color='blue').add_to(m)
 
134
  folium.GeoJson(st.session_state.polygons["Polygon3"][st.session_state.polygons["Polygon3"].index==polygon_name3[0]],color='orange').add_to(m)
135
 
136
  point = Point(longitude, latitude)
137
+
138
 
139
 
140
  if not np.isnan(polygon_name1[0]):
 
150
  st.markdown(f"Risk check OK", unsafe_allow_html=True)
151
 
152
 
153
+ st_folium(m, width=700, height=500)
154
+
155
  # Run the app
156
  if __name__ == "__main__":
157
  main()