Mike commited on
Commit
15813a9
·
1 Parent(s): f49f471

Changed venv files

Browse files
Files changed (3) hide show
  1. app.py +19 -83
  2. pyproject.toml +2 -0
  3. uv.lock +35 -0
app.py CHANGED
@@ -1,93 +1,29 @@
1
- import json
2
- from pathlib import Path
3
 
4
- import pydeck as pdk
5
  import streamlit as st
6
 
7
- st.set_page_config(page_title="Финский залив", layout="wide")
8
- st.title("Финский залив")
9
 
10
- DATA_DIR = Path(__file__).parent / "data"
 
11
 
12
- @st.cache_data
13
- def load_data():
14
- with open(DATA_DIR / "neva_zone.geojson") as f:
15
- zones = json.load(f)
16
- with open(DATA_DIR / "passages.json") as f:
17
- passages = json.load(f)
18
- return zones, passages
19
 
20
- zones, passages = load_data()
21
 
22
- with open(DATA_DIR / "stations.json") as f:
23
- stations = json.load(f)
 
 
 
 
24
 
25
- def zone_color(feature):
26
- return [0, 80, 200, 100] if feature["properties"]["zone"] == "north" else [0, 160, 80, 100]
27
 
28
- zones_colored = {
29
- "type": "FeatureCollection",
30
- "features": [
31
- {**f, "properties": {**f["properties"],
32
- "fill_color": [0, 80, 200, 100] if f["properties"]["zone"] == "north" else [0, 160, 80, 100],
33
- "line_color": [0, 40, 150, 220] if f["properties"]["zone"] == "north" else [0, 100, 40, 220],
34
- }}
35
- for f in zones["features"]
36
- ]
37
- }
38
-
39
- passages_data = [
40
- {"name": v["name"], "lat": v["lat"], "lon": v["lon"]}
41
- for v in passages.values()
42
- ]
43
-
44
- zone_layer = pdk.Layer(
45
- "GeoJsonLayer",
46
- data=zones_colored,
47
- filled=True,
48
- stroked=True,
49
- get_fill_color="properties.fill_color",
50
- get_line_color="properties.line_color",
51
- get_line_width=30,
52
- pickable=True,
53
- )
54
-
55
- passage_layer = pdk.Layer(
56
- "ScatterplotLayer",
57
- data=passages_data,
58
- get_position="[lon, lat]",
59
- get_color=[255, 60, 0, 220],
60
- get_radius=150,
61
- pickable=True,
62
- )
63
-
64
- station_layer = pdk.Layer(
65
- "ScatterplotLayer",
66
- data=stations,
67
- get_position="[lon, lat]",
68
- get_color=[255, 200, 0, 240],
69
- get_radius=200,
70
- pickable=True,
71
- )
72
-
73
- station_labels = pdk.Layer(
74
- "TextLayer",
75
- data=stations,
76
- get_position="[lon, lat]",
77
- get_text="name",
78
- get_size=14,
79
- get_color=[0, 0, 0, 255],
80
- get_anchor="start",
81
- get_pixel_offset="[15, 0]",
82
- )
83
-
84
- view = pdk.ViewState(latitude=60.00, longitude=29.85, zoom=10, pitch=40)
85
-
86
- st.pydeck_chart(
87
- pdk.Deck(
88
- layers=[zone_layer, passage_layer, station_layer, station_labels],
89
- initial_view_state=view,
90
- tooltip={"text": "{name}"},
91
- ),
92
- height=800,
93
  )
 
1
+ """Home page — project overview."""
 
2
 
 
3
  import streamlit as st
4
 
5
+ st.set_page_config(page_title="Спасательные станции", layout="wide")
 
6
 
7
+ st.title("Размещение спасательных станций")
8
+ st.markdown("Невская губа, Финский залив, Санкт-Петербург")
9
 
10
+ st.markdown(
11
+ """
12
+ ## Страницы
 
 
 
 
13
 
14
+ Используйте боковое меню для навигации:
15
 
16
+ 1. **Карта** базовая карта акватории со станциями и судопропускными сооружениями
17
+ 2. **Достижимость** — тепловая карта минимального времени достижения каждой точки акватории
18
+ 3. **Покрытие** — анализ покрытия (в разработке)
19
+ 4. **Оптимизация** — оптимальное размещение станций (в разработке)
20
+ 5. **Выживаемость** — модель выживаемости (в разработке)
21
+ 6. **Сценарии** — сравнение конфигураций (в разработке)
22
 
23
+ ## Данные
 
24
 
25
+ - **10 спасательных станций** с координатами и скоростями
26
+ - **2 судопропускных сооружения** (С-1 южное, С-2 северное)
27
+ - **Акватория** — полигоны из OSM, северная и южная зоны
28
+ """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  )
pyproject.toml CHANGED
@@ -5,8 +5,10 @@ description = "Add your description here"
5
  readme = "README.md"
6
  requires-python = ">=3.14"
7
  dependencies = [
 
8
  "osmnx>=2.1.0",
9
  "pydeck>=0.9.1",
 
10
  "shapely>=2.1.2",
11
  "streamlit>=1.56.0",
12
  ]
 
5
  readme = "README.md"
6
  requires-python = ">=3.14"
7
  dependencies = [
8
+ "numpy>=2.0",
9
  "osmnx>=2.1.0",
10
  "pydeck>=0.9.1",
11
+ "scipy>=1.14",
12
  "shapely>=2.1.2",
13
  "streamlit>=1.56.0",
14
  ]
uv.lock CHANGED
@@ -524,16 +524,20 @@ name = "rescue-stations-placement"
524
  version = "0.1.0"
525
  source = { virtual = "." }
526
  dependencies = [
 
527
  { name = "osmnx" },
528
  { name = "pydeck" },
 
529
  { name = "shapely" },
530
  { name = "streamlit" },
531
  ]
532
 
533
  [package.metadata]
534
  requires-dist = [
 
535
  { name = "osmnx", specifier = ">=2.1.0" },
536
  { name = "pydeck", specifier = ">=0.9.1" },
 
537
  { name = "shapely", specifier = ">=2.1.2" },
538
  { name = "streamlit", specifier = ">=1.56.0" },
539
  ]
@@ -575,6 +579,37 @@ wheels = [
575
  { url = "https://files.pythonhosted.org/packages/d0/02/fa464cdfbe6b26e0600b62c528b72d8608f5cc49f96b8d6e38c95d60c676/rpds_py-0.30.0-cp314-cp314t-win_amd64.whl", hash = "sha256:27f4b0e92de5bfbc6f86e43959e6edd1425c33b5e69aab0984a72047f2bcf1e3", size = 226532, upload-time = "2025-11-30T20:24:14.634Z" },
576
  ]
577
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
578
  [[package]]
579
  name = "shapely"
580
  version = "2.1.2"
 
524
  version = "0.1.0"
525
  source = { virtual = "." }
526
  dependencies = [
527
+ { name = "numpy" },
528
  { name = "osmnx" },
529
  { name = "pydeck" },
530
+ { name = "scipy" },
531
  { name = "shapely" },
532
  { name = "streamlit" },
533
  ]
534
 
535
  [package.metadata]
536
  requires-dist = [
537
+ { name = "numpy", specifier = ">=2.0" },
538
  { name = "osmnx", specifier = ">=2.1.0" },
539
  { name = "pydeck", specifier = ">=0.9.1" },
540
+ { name = "scipy", specifier = ">=1.14" },
541
  { name = "shapely", specifier = ">=2.1.2" },
542
  { name = "streamlit", specifier = ">=1.56.0" },
543
  ]
 
579
  { url = "https://files.pythonhosted.org/packages/d0/02/fa464cdfbe6b26e0600b62c528b72d8608f5cc49f96b8d6e38c95d60c676/rpds_py-0.30.0-cp314-cp314t-win_amd64.whl", hash = "sha256:27f4b0e92de5bfbc6f86e43959e6edd1425c33b5e69aab0984a72047f2bcf1e3", size = 226532, upload-time = "2025-11-30T20:24:14.634Z" },
580
  ]
581
 
582
+ [[package]]
583
+ name = "scipy"
584
+ version = "1.17.1"
585
+ source = { registry = "https://pypi.org/simple" }
586
+ dependencies = [
587
+ { name = "numpy" },
588
+ ]
589
+ sdist = { url = "https://files.pythonhosted.org/packages/7a/97/5a3609c4f8d58b039179648e62dd220f89864f56f7357f5d4f45c29eb2cc/scipy-1.17.1.tar.gz", hash = "sha256:95d8e012d8cb8816c226aef832200b1d45109ed4464303e997c5b13122b297c0", size = 30573822, upload-time = "2026-02-23T00:26:24.851Z" }
590
+ wheels = [
591
+ { url = "https://files.pythonhosted.org/packages/cf/83/333afb452af6f0fd70414dc04f898647ee1423979ce02efa75c3b0f2c28e/scipy-1.17.1-cp314-cp314-macosx_10_14_x86_64.whl", hash = "sha256:a48a72c77a310327f6a3a920092fa2b8fd03d7deaa60f093038f22d98e096717", size = 31584510, upload-time = "2026-02-23T00:21:01.015Z" },
592
+ { url = "https://files.pythonhosted.org/packages/ed/a6/d05a85fd51daeb2e4ea71d102f15b34fedca8e931af02594193ae4fd25f7/scipy-1.17.1-cp314-cp314-macosx_12_0_arm64.whl", hash = "sha256:45abad819184f07240d8a696117a7aacd39787af9e0b719d00285549ed19a1e9", size = 28170131, upload-time = "2026-02-23T00:21:05.888Z" },
593
+ { url = "https://files.pythonhosted.org/packages/db/7b/8624a203326675d7746a254083a187398090a179335b2e4a20e2ddc46e83/scipy-1.17.1-cp314-cp314-macosx_14_0_arm64.whl", hash = "sha256:3fd1fcdab3ea951b610dc4cef356d416d5802991e7e32b5254828d342f7b7e0b", size = 20342032, upload-time = "2026-02-23T00:21:09.904Z" },
594
+ { url = "https://files.pythonhosted.org/packages/c9/35/2c342897c00775d688d8ff3987aced3426858fd89d5a0e26e020b660b301/scipy-1.17.1-cp314-cp314-macosx_14_0_x86_64.whl", hash = "sha256:7bdf2da170b67fdf10bca777614b1c7d96ae3ca5794fd9587dce41eb2966e866", size = 22678766, upload-time = "2026-02-23T00:21:14.313Z" },
595
+ { url = "https://files.pythonhosted.org/packages/ef/f2/7cdb8eb308a1a6ae1e19f945913c82c23c0c442a462a46480ce487fdc0ac/scipy-1.17.1-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:adb2642e060a6549c343603a3851ba76ef0b74cc8c079a9a58121c7ec9fe2350", size = 32957007, upload-time = "2026-02-23T00:21:19.663Z" },
596
+ { url = "https://files.pythonhosted.org/packages/0b/2e/7eea398450457ecb54e18e9d10110993fa65561c4f3add5e8eccd2b9cd41/scipy-1.17.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:eee2cfda04c00a857206a4330f0c5e3e56535494e30ca445eb19ec624ae75118", size = 35221333, upload-time = "2026-02-23T00:21:25.278Z" },
597
+ { url = "https://files.pythonhosted.org/packages/d9/77/5b8509d03b77f093a0d52e606d3c4f79e8b06d1d38c441dacb1e26cacf46/scipy-1.17.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:d2650c1fb97e184d12d8ba010493ee7b322864f7d3d00d3f9bb97d9c21de4068", size = 35042066, upload-time = "2026-02-23T00:21:31.358Z" },
598
+ { url = "https://files.pythonhosted.org/packages/f9/df/18f80fb99df40b4070328d5ae5c596f2f00fffb50167e31439e932f29e7d/scipy-1.17.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:08b900519463543aa604a06bec02461558a6e1cef8fdbb8098f77a48a83c8118", size = 37612763, upload-time = "2026-02-23T00:21:37.247Z" },
599
+ { url = "https://files.pythonhosted.org/packages/4b/39/f0e8ea762a764a9dc52aa7dabcfad51a354819de1f0d4652b6a1122424d6/scipy-1.17.1-cp314-cp314-win_amd64.whl", hash = "sha256:3877ac408e14da24a6196de0ddcace62092bfc12a83823e92e49e40747e52c19", size = 37290984, upload-time = "2026-02-23T00:22:35.023Z" },
600
+ { url = "https://files.pythonhosted.org/packages/7c/56/fe201e3b0f93d1a8bcf75d3379affd228a63d7e2d80ab45467a74b494947/scipy-1.17.1-cp314-cp314-win_arm64.whl", hash = "sha256:f8885db0bc2bffa59d5c1b72fad7a6a92d3e80e7257f967dd81abb553a90d293", size = 25192877, upload-time = "2026-02-23T00:22:39.798Z" },
601
+ { url = "https://files.pythonhosted.org/packages/96/ad/f8c414e121f82e02d76f310f16db9899c4fcde36710329502a6b2a3c0392/scipy-1.17.1-cp314-cp314t-macosx_10_14_x86_64.whl", hash = "sha256:1cc682cea2ae55524432f3cdff9e9a3be743d52a7443d0cba9017c23c87ae2f6", size = 31949750, upload-time = "2026-02-23T00:21:42.289Z" },
602
+ { url = "https://files.pythonhosted.org/packages/7c/b0/c741e8865d61b67c81e255f4f0a832846c064e426636cd7de84e74d209be/scipy-1.17.1-cp314-cp314t-macosx_12_0_arm64.whl", hash = "sha256:2040ad4d1795a0ae89bfc7e8429677f365d45aa9fd5e4587cf1ea737f927b4a1", size = 28585858, upload-time = "2026-02-23T00:21:47.706Z" },
603
+ { url = "https://files.pythonhosted.org/packages/ed/1b/3985219c6177866628fa7c2595bfd23f193ceebbe472c98a08824b9466ff/scipy-1.17.1-cp314-cp314t-macosx_14_0_arm64.whl", hash = "sha256:131f5aaea57602008f9822e2115029b55d4b5f7c070287699fe45c661d051e39", size = 20757723, upload-time = "2026-02-23T00:21:52.039Z" },
604
+ { url = "https://files.pythonhosted.org/packages/c0/19/2a04aa25050d656d6f7b9e7b685cc83d6957fb101665bfd9369ca6534563/scipy-1.17.1-cp314-cp314t-macosx_14_0_x86_64.whl", hash = "sha256:9cdc1a2fcfd5c52cfb3045feb399f7b3ce822abdde3a193a6b9a60b3cb5854ca", size = 23043098, upload-time = "2026-02-23T00:21:56.185Z" },
605
+ { url = "https://files.pythonhosted.org/packages/86/f1/3383beb9b5d0dbddd030335bf8a8b32d4317185efe495374f134d8be6cce/scipy-1.17.1-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6e3dcd57ab780c741fde8dc68619de988b966db759a3c3152e8e9142c26295ad", size = 33030397, upload-time = "2026-02-23T00:22:01.404Z" },
606
+ { url = "https://files.pythonhosted.org/packages/41/68/8f21e8a65a5a03f25a79165ec9d2b28c00e66dc80546cf5eb803aeeff35b/scipy-1.17.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a9956e4d4f4a301ebf6cde39850333a6b6110799d470dbbb1e25326ac447f52a", size = 35281163, upload-time = "2026-02-23T00:22:07.024Z" },
607
+ { url = "https://files.pythonhosted.org/packages/84/8d/c8a5e19479554007a5632ed7529e665c315ae7492b4f946b0deb39870e39/scipy-1.17.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:a4328d245944d09fd639771de275701ccadf5f781ba0ff092ad141e017eccda4", size = 35116291, upload-time = "2026-02-23T00:22:12.585Z" },
608
+ { url = "https://files.pythonhosted.org/packages/52/52/e57eceff0e342a1f50e274264ed47497b59e6a4e3118808ee58ddda7b74a/scipy-1.17.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:a77cbd07b940d326d39a1d1b37817e2ee4d79cb30e7338f3d0cddffae70fcaa2", size = 37682317, upload-time = "2026-02-23T00:22:18.513Z" },
609
+ { url = "https://files.pythonhosted.org/packages/11/2f/b29eafe4a3fbc3d6de9662b36e028d5f039e72d345e05c250e121a230dd4/scipy-1.17.1-cp314-cp314t-win_amd64.whl", hash = "sha256:eb092099205ef62cd1782b006658db09e2fed75bffcae7cc0d44052d8aa0f484", size = 37345327, upload-time = "2026-02-23T00:22:24.442Z" },
610
+ { url = "https://files.pythonhosted.org/packages/07/39/338d9219c4e87f3e708f18857ecd24d22a0c3094752393319553096b98af/scipy-1.17.1-cp314-cp314t-win_arm64.whl", hash = "sha256:200e1050faffacc162be6a486a984a0497866ec54149a01270adc8a59b7c7d21", size = 25489165, upload-time = "2026-02-23T00:22:29.563Z" },
611
+ ]
612
+
613
  [[package]]
614
  name = "shapely"
615
  version = "2.1.2"