dredddddd commited on
Commit
ad169c2
·
1 Parent(s): f44a7e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +70 -70
app.py CHANGED
@@ -225,78 +225,78 @@ st.write(df)
225
  st.subheader('Интерактивная карта')
226
  # PLOT(df['serv'][0],df['food'][0],df['metro'][0],df['highway'][0],df['area_forest'][0],df['forest'][0],df['school'][0],df['railway'][0])
227
  m = folium.Map(location=[55.87890, 37.71943], zoom_start=10, tiles='CartoDB positron')
228
- locations_gpd = geopandas.GeoDataFrame(Eda.geometry)
229
- locations_gpd.geometry = locations_gpd.geometry.buffer(df['serv'][0],resolution=2)
230
- K = locations_gpd.geometry.unary_union
231
- locations_gpd1 = geopandas.GeoDataFrame(Uslugi.geometry)
232
- locations_gpd1.geometry = locations_gpd1.geometry.buffer(df['food'][0],resolution=2)
233
- T = locations_gpd1.geometry.unary_union
234
-
235
- locations_gpd_m = geopandas.GeoDataFrame(Metro.geometry)
236
- locations_gpd_m.geometry = locations_gpd_m.geometry.buffer(df['metro'][0],resolution=2)
237
- M = locations_gpd_m.geometry.unary_union
238
- locations_gpd_H = geopandas.GeoDataFrame(Shosse.geometry)
239
- locations_gpd_H.geometry = locations_gpd_H.geometry.buffer(df['highway'][0],resolution=2)
240
- H = locations_gpd_H.geometry.unary_union
241
-
242
- Forests = geopandas.GeoDataFrame(Lesa.geometry)
243
- Forests = Forests[Forests.geometry.area > df['area_forest'][0]]
244
- Forests.geometry = Forests.geometry.buffer(df['forest'][0],resolution=2)
245
- F = Forests.geometry.unary_union
246
-
247
- locations_gpd_Sc = geopandas.GeoDataFrame(Shkoly.geometry)
248
- locations_gpd_Sc.geometry = locations_gpd_Sc.geometry.buffer(df['school'][0],resolution=2)
249
- Sc = locations_gpd_Sc.geometry.unary_union
250
-
251
- locations_gpd_R = geopandas.GeoDataFrame(Zhd.geometry)
252
- locations_gpd_R.geometry = locations_gpd_R.geometry.buffer(df['railway'][0],resolution=2)
253
- Ra = locations_gpd_R.geometry.unary_union
254
-
255
- url = "https://cdn-icons-png.flaticon.com/512/746/746859.png{}".format
256
- beerGlass_img = url("")
257
- custom_icon = folium.CustomIcon(beerGlass_img, icon_size=(35, 35), popup_anchor=(0, -22))
258
- insta_post = 'https://www.instagram.com/p/CjcvNysq8om/'
259
- website = 'vk.com'
260
- name = 'bebra'
261
- directions = 'https://yandex.ru/maps/213/moscow/stops/2057340510/?ll=37.593517%2C55.775694&tab=overview&z=12.32'
262
- realty_html = folium.Html(f"""<p style="text-align: center;"><span style="font-family: Didot, serif; font-size: 21px;">{name}</span></p>
263
- <p style="text-align: center;"><iframe src={insta_post}embed width="240" height="290" frameborder="0" scrolling="auto" allowtransparency="true"></iframe>
264
- <p style="text-align: center;"><a href={website} target="_blank" title="{name} Website"><span style="font-family: Didot, serif; font-size: 17px;">{name} Website</span></a></p>
265
- <p style="text-align: center;"><a href={directions} target="_blank" title="Directions to {name}"><span style="font-family: Didot, serif; font-size: 17px;">Directions to {name}</span></a></p>
266
- # """, script=True)
267
-
268
- popup = folium.Popup(realty_html, max_width=700)
269
-
270
- custom_marker = folium.Marker(location=[55.87890,37.71943], icon=custom_icon, tooltip=name, popup=popup)
271
-
272
-
273
- R = K.intersection(T)
274
- R = R.intersection(M)
275
- R= R.difference(H)
276
- R = R.intersection(F)
277
- R = R.intersection(Sc)
278
- R= R.difference(Ra)
279
- wgs84 = pyproj.CRS('EPSG:25837')
280
- utm = pyproj.CRS('EPSG:4326')
281
-
282
- project = pyproj.Transformer.from_crs(wgs84, utm, always_xy=True).transform
283
- utm_point = transform(project, R)
284
- R = folium.GeoJson(data=utm_point, style_function=lambda x: {'fillColor': 'orange'})
285
- b = folium.GeoJson(data=M, style_function=lambda x: {'fillColor': '#00000000', 'color': '#00000000'})
286
- AH = folium.GeoJson(data=(Data1), style_function=lambda x: {'fillColor': '#00000000', 'color': 'black'})
287
-
288
- fg1 = folium.map.FeatureGroup(name='Metro').add_to(m)
289
- fg2 = folium.map.FeatureGroup(name='Plot').add_to(m)
290
- fg3 = folium.map.FeatureGroup(name='Districts').add_to(m)
291
  fg4 = folium.map.FeatureGroup(name='rightzhk').add_to(m)
292
  # fg5 = folium.map.FeatureGroup(name='badzhk').add_to(m)
293
- R.add_child(folium.Popup('Plot'))
294
- b.add_child(folium.Popup('Метро'))
295
- AH.add_child(folium.Popup('Районы'))
296
- custom_marker.add_to(fg2)
297
- fg1.add_child(b)
298
- fg2.add_child(R)
299
- fg3.add_child(AH)
300
  MATRIX = A
301
  MATRIX = MATRIX.loc[(MATRIX.Food<df['food'][0])& (MATRIX.Service<df['serv'][0])&(MATRIX.Metro<df['metro'][0])& (MATRIX.Forest<df['forest'][0])& (MATRIX.Schools<df['school'][0])& (MATRIX.Railway>df['railway'][0])& (MATRIX.Highway>df['highway'][0])]
302
  for i,row in MATRIX.iterrows():
 
225
  st.subheader('Интерактивная карта')
226
  # PLOT(df['serv'][0],df['food'][0],df['metro'][0],df['highway'][0],df['area_forest'][0],df['forest'][0],df['school'][0],df['railway'][0])
227
  m = folium.Map(location=[55.87890, 37.71943], zoom_start=10, tiles='CartoDB positron')
228
+ # locations_gpd = geopandas.GeoDataFrame(Eda.geometry)
229
+ # locations_gpd.geometry = locations_gpd.geometry.buffer(df['serv'][0],resolution=2)
230
+ # K = locations_gpd.geometry.unary_union
231
+ # locations_gpd1 = geopandas.GeoDataFrame(Uslugi.geometry)
232
+ # locations_gpd1.geometry = locations_gpd1.geometry.buffer(df['food'][0],resolution=2)
233
+ # T = locations_gpd1.geometry.unary_union
234
+
235
+ # locations_gpd_m = geopandas.GeoDataFrame(Metro.geometry)
236
+ # locations_gpd_m.geometry = locations_gpd_m.geometry.buffer(df['metro'][0],resolution=2)
237
+ # M = locations_gpd_m.geometry.unary_union
238
+ # locations_gpd_H = geopandas.GeoDataFrame(Shosse.geometry)
239
+ # locations_gpd_H.geometry = locations_gpd_H.geometry.buffer(df['highway'][0],resolution=2)
240
+ # H = locations_gpd_H.geometry.unary_union
241
+
242
+ # Forests = geopandas.GeoDataFrame(Lesa.geometry)
243
+ # Forests = Forests[Forests.geometry.area > df['area_forest'][0]]
244
+ # Forests.geometry = Forests.geometry.buffer(df['forest'][0],resolution=2)
245
+ # F = Forests.geometry.unary_union
246
+
247
+ # locations_gpd_Sc = geopandas.GeoDataFrame(Shkoly.geometry)
248
+ # locations_gpd_Sc.geometry = locations_gpd_Sc.geometry.buffer(df['school'][0],resolution=2)
249
+ # Sc = locations_gpd_Sc.geometry.unary_union
250
+
251
+ # locations_gpd_R = geopandas.GeoDataFrame(Zhd.geometry)
252
+ # locations_gpd_R.geometry = locations_gpd_R.geometry.buffer(df['railway'][0],resolution=2)
253
+ # Ra = locations_gpd_R.geometry.unary_union
254
+
255
+ # url = "https://cdn-icons-png.flaticon.com/512/746/746859.png{}".format
256
+ # beerGlass_img = url("")
257
+ # custom_icon = folium.CustomIcon(beerGlass_img, icon_size=(35, 35), popup_anchor=(0, -22))
258
+ # insta_post = 'https://www.instagram.com/p/CjcvNysq8om/'
259
+ # website = 'vk.com'
260
+ # name = 'bebra'
261
+ # directions = 'https://yandex.ru/maps/213/moscow/stops/2057340510/?ll=37.593517%2C55.775694&tab=overview&z=12.32'
262
+ # realty_html = folium.Html(f"""<p style="text-align: center;"><span style="font-family: Didot, serif; font-size: 21px;">{name}</span></p>
263
+ # <p style="text-align: center;"><iframe src={insta_post}embed width="240" height="290" frameborder="0" scrolling="auto" allowtransparency="true"></iframe>
264
+ # <p style="text-align: center;"><a href={website} target="_blank" title="{name} Website"><span style="font-family: Didot, serif; font-size: 17px;">{name} Website</span></a></p>
265
+ # <p style="text-align: center;"><a href={directions} target="_blank" title="Directions to {name}"><span style="font-family: Didot, serif; font-size: 17px;">Directions to {name}</span></a></p>
266
+ # # """, script=True)
267
+
268
+ # popup = folium.Popup(realty_html, max_width=700)
269
+
270
+ # custom_marker = folium.Marker(location=[55.87890,37.71943], icon=custom_icon, tooltip=name, popup=popup)
271
+
272
+
273
+ # R = K.intersection(T)
274
+ # R = R.intersection(M)
275
+ # R= R.difference(H)
276
+ # R = R.intersection(F)
277
+ # R = R.intersection(Sc)
278
+ # R= R.difference(Ra)
279
+ # wgs84 = pyproj.CRS('EPSG:25837')
280
+ # utm = pyproj.CRS('EPSG:4326')
281
+
282
+ # project = pyproj.Transformer.from_crs(wgs84, utm, always_xy=True).transform
283
+ # utm_point = transform(project, R)
284
+ # R = folium.GeoJson(data=utm_point, style_function=lambda x: {'fillColor': 'orange'})
285
+ # b = folium.GeoJson(data=M, style_function=lambda x: {'fillColor': '#00000000', 'color': '#00000000'})
286
+ # AH = folium.GeoJson(data=(Data1), style_function=lambda x: {'fillColor': '#00000000', 'color': 'black'})
287
+
288
+ # fg1 = folium.map.FeatureGroup(name='Metro').add_to(m)
289
+ # fg2 = folium.map.FeatureGroup(name='Plot').add_to(m)
290
+ # fg3 = folium.map.FeatureGroup(name='Districts').add_to(m)
291
  fg4 = folium.map.FeatureGroup(name='rightzhk').add_to(m)
292
  # fg5 = folium.map.FeatureGroup(name='badzhk').add_to(m)
293
+ # R.add_child(folium.Popup('Plot'))
294
+ # b.add_child(folium.Popup('Метро'))
295
+ # AH.add_child(folium.Popup('Районы'))
296
+ # custom_marker.add_to(fg2)
297
+ # fg1.add_child(b)
298
+ # fg2.add_child(R)
299
+ # fg3.add_child(AH)
300
  MATRIX = A
301
  MATRIX = MATRIX.loc[(MATRIX.Food<df['food'][0])& (MATRIX.Service<df['serv'][0])&(MATRIX.Metro<df['metro'][0])& (MATRIX.Forest<df['forest'][0])& (MATRIX.Schools<df['school'][0])& (MATRIX.Railway>df['railway'][0])& (MATRIX.Highway>df['highway'][0])]
302
  for i,row in MATRIX.iterrows():