ObjectNat 1.2.0__tar.gz → 1.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ObjectNat might be problematic. Click here for more details.
- {objectnat-1.2.0 → objectnat-1.2.2}/LICENSE.txt +28 -28
- objectnat-1.2.2/PKG-INFO +116 -0
- objectnat-1.2.2/README.md +92 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/pyproject.toml +72 -68
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/__init__.py +9 -13
- objectnat-1.2.2/src/objectnat/_version.py +1 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/coverage_zones/graph_coverage.py +98 -108
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/coverage_zones/radius_voronoi_coverage.py +37 -45
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/coverage_zones/stepped_coverage.py +126 -142
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/isochrones/isochrones.py +262 -299
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/noise/__init__.py +0 -1
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/noise/noise_simulation.py +452 -440
- objectnat-1.2.2/src/objectnat/methods/noise/noise_simulation_simplified.py +209 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/point_clustering/cluster_points_in_polygons.py +115 -116
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/provision/provision.py +121 -110
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/provision/provision_model.py +12 -1
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/utils/graph_utils.py +306 -320
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/visibility/visibility_analysis.py +470 -511
- objectnat-1.2.0/PKG-INFO +0 -148
- objectnat-1.2.0/README.md +0 -124
- objectnat-1.2.0/src/objectnat/_version.py +0 -1
- objectnat-1.2.0/src/objectnat/methods/noise/noise_exceptions.py +0 -14
- objectnat-1.2.0/src/objectnat/methods/noise/noise_simulation_simplified.py +0 -135
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/_api.py +0 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/_config.py +0 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/__init__.py +0 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/coverage_zones/__init__.py +0 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/isochrones/__init__.py +0 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/isochrones/isochrone_utils.py +0 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/noise/noise_init_data.py +0 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/noise/noise_reduce.py +0 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/point_clustering/__init__.py +0 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/provision/__init__.py +0 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/provision/provision_exceptions.py +0 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/utils/__init__.py +0 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/utils/geom_utils.py +0 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/utils/math_utils.py +0 -0
- {objectnat-1.2.0 → objectnat-1.2.2}/src/objectnat/methods/visibility/__init__.py +0 -0
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
BSD 3-Clause License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023, iduprojects
|
|
4
|
-
|
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
|
6
|
-
modification, are permitted provided that the following conditions are met:
|
|
7
|
-
|
|
8
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
-
list of conditions and the following disclaimer.
|
|
10
|
-
|
|
11
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
-
this list of conditions and the following disclaimer in the documentation
|
|
13
|
-
and/or other materials provided with the distribution.
|
|
14
|
-
|
|
15
|
-
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
-
contributors may be used to endorse or promote products derived from
|
|
17
|
-
this software without specific prior written permission.
|
|
18
|
-
|
|
19
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023, iduprojects
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
objectnat-1.2.2/PKG-INFO
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ObjectNat
|
|
3
|
+
Version: 1.2.2
|
|
4
|
+
Summary: ObjectNat is an open-source library created for geospatial analysis created by IDU team
|
|
5
|
+
License: BSD-3-Clause
|
|
6
|
+
License-File: LICENSE.txt
|
|
7
|
+
Author: DDonnyy
|
|
8
|
+
Author-email: 63115678+DDonnyy@users.noreply.github.com
|
|
9
|
+
Requires-Python: >=3.10,<3.13
|
|
10
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Requires-Dist: geopandas (>=1.0.1,<2.0.0)
|
|
16
|
+
Requires-Dist: loguru (>=0.7.3,<0.8.0)
|
|
17
|
+
Requires-Dist: networkx (>=3.4.2,<4.0.0)
|
|
18
|
+
Requires-Dist: numpy (>=2.1.3,<3.0.0)
|
|
19
|
+
Requires-Dist: pandarallel (>=1.6.5,<2.0.0)
|
|
20
|
+
Requires-Dist: pandas (>=2.2.0,<3.0.0)
|
|
21
|
+
Requires-Dist: scikit-learn (>=1.4.0,<2.0.0)
|
|
22
|
+
Requires-Dist: tqdm (>=4.66.2,<5.0.0)
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# ObjectNat
|
|
26
|
+
|
|
27
|
+
[](https://github.com/psf/black)
|
|
28
|
+
[](https://pypi.org/project/objectnat/)
|
|
29
|
+
[](https://github.com/DDonnyy/ObjecNat/actions/workflows/ci_pipeline.yml)
|
|
30
|
+
[](https://codecov.io/gh/DDonnyy/ObjectNat)
|
|
31
|
+
[](https://opensource.org/licenses/MIT)
|
|
32
|
+
|
|
33
|
+
- [РИДМИ (Russian)](README_ru.md)
|
|
34
|
+
<p align="center">
|
|
35
|
+
<img src="https://github.com/user-attachments/assets/ed0f226e-1728-4659-9e21-b4d499e703cd" alt="logo" width="400">
|
|
36
|
+
</p>
|
|
37
|
+
|
|
38
|
+
#### **ObjectNat** is an open-source library created for geospatial analysis created by **IDU team**
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Features and How to Use
|
|
43
|
+
|
|
44
|
+
Each feature is accompanied by a Jupyter notebook example and full documentation.
|
|
45
|
+
|
|
46
|
+
1. **[Isochrones and Transport Accessibility](./examples/isochrone_generator.ipynb)**
|
|
47
|
+
Analyze areas reachable within a given time along a transport network.
|
|
48
|
+
📄 [See documentation](https://iduclub.github.io/ObjectNat/latest/usage/isochrones.html)
|
|
49
|
+
|
|
50
|
+
2. **[Coverage Zones](./examples/coverage_zones.ipynb)**
|
|
51
|
+
Build zones of reachability for each point using routing or simple radius.
|
|
52
|
+
📄 [See documentation](https://iduclub.github.io/ObjectNat/latest/usage/coverage.html)
|
|
53
|
+
|
|
54
|
+
3. **[Service Provision Analysis](./examples/calculate_provision.ipynb)**
|
|
55
|
+
Evaluate service availability and model demand-supply balance.
|
|
56
|
+
📄 [See documentation](https://iduclub.github.io/ObjectNat/latest/usage/provision.html)
|
|
57
|
+
|
|
58
|
+
4. **[Visibility Analysis](./examples/visibility_analysis.ipynb)**
|
|
59
|
+
Estimate visibility to nearby buildings from selected points.
|
|
60
|
+
📄 [See documentation](https://iduclub.github.io/ObjectNat/latest/usage/visibility.html)
|
|
61
|
+
|
|
62
|
+
5. **[Noise Simulation](./examples/noise_simulation.ipynb)**
|
|
63
|
+
Simulate noise propagation considering obstacles and environment.
|
|
64
|
+
📄 [See documentation](https://iduclub.github.io/ObjectNat/latest/usage/noise.html)
|
|
65
|
+
🔗 [Detailed theory in the Wiki](https://github.com/DDonnyy/ObjectNat/wiki/Noise-simulation)
|
|
66
|
+
|
|
67
|
+
6. **[Point Clusterization](./examples/point_clusterization.ipynb)**
|
|
68
|
+
Group nearby points into clusters and analyze service composition.
|
|
69
|
+
📄 [See documentation](https://iduclub.github.io/ObjectNat/latest/usage/clustering.html)
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## City graphs
|
|
74
|
+
|
|
75
|
+
To ensure optimal performance of ObjectNat's geospatial analysis functions, it's recommended to utilize urban graphs sourced from the [IduEdu](https://github.com/DDonnyy/IduEdu) library.
|
|
76
|
+
**IduEdu** is an open-source Python library designed for the creation and manipulation of complex city networks derived from OpenStreetMap data.
|
|
77
|
+
|
|
78
|
+
**IduEdu** can be installed with ``pip``:
|
|
79
|
+
```
|
|
80
|
+
pip install IduEdu
|
|
81
|
+
```
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Installation
|
|
85
|
+
|
|
86
|
+
**ObjectNat** can be installed with ``pip``:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
pip install ObjectNat
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### Configuration changes
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from objectnat import config
|
|
98
|
+
|
|
99
|
+
config.change_logger_lvl('INFO') # To mute all debug msgs
|
|
100
|
+
config.set_enable_tqdm(False) # To mute all tqdm's progress bars
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Contacts
|
|
106
|
+
|
|
107
|
+
- [NCCR](https://actcognitive.org/) - National Center for Cognitive Research
|
|
108
|
+
- [IDU](https://idu.itmo.ru/) - Institute of Design and Urban Studies
|
|
109
|
+
- [Natalya Chichkova](https://t.me/nancy_nat) - project manager
|
|
110
|
+
- [Danila Oleynikov (Donny)](https://t.me/ddonny_dd) - lead software engineer
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Publications
|
|
115
|
+
|
|
116
|
+
_Coming soon._
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# ObjectNat
|
|
2
|
+
|
|
3
|
+
[](https://github.com/psf/black)
|
|
4
|
+
[](https://pypi.org/project/objectnat/)
|
|
5
|
+
[](https://github.com/DDonnyy/ObjecNat/actions/workflows/ci_pipeline.yml)
|
|
6
|
+
[](https://codecov.io/gh/DDonnyy/ObjectNat)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
- [РИДМИ (Russian)](README_ru.md)
|
|
10
|
+
<p align="center">
|
|
11
|
+
<img src="https://github.com/user-attachments/assets/ed0f226e-1728-4659-9e21-b4d499e703cd" alt="logo" width="400">
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
#### **ObjectNat** is an open-source library created for geospatial analysis created by **IDU team**
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Features and How to Use
|
|
19
|
+
|
|
20
|
+
Each feature is accompanied by a Jupyter notebook example and full documentation.
|
|
21
|
+
|
|
22
|
+
1. **[Isochrones and Transport Accessibility](./examples/isochrone_generator.ipynb)**
|
|
23
|
+
Analyze areas reachable within a given time along a transport network.
|
|
24
|
+
📄 [See documentation](https://iduclub.github.io/ObjectNat/latest/usage/isochrones.html)
|
|
25
|
+
|
|
26
|
+
2. **[Coverage Zones](./examples/coverage_zones.ipynb)**
|
|
27
|
+
Build zones of reachability for each point using routing or simple radius.
|
|
28
|
+
📄 [See documentation](https://iduclub.github.io/ObjectNat/latest/usage/coverage.html)
|
|
29
|
+
|
|
30
|
+
3. **[Service Provision Analysis](./examples/calculate_provision.ipynb)**
|
|
31
|
+
Evaluate service availability and model demand-supply balance.
|
|
32
|
+
📄 [See documentation](https://iduclub.github.io/ObjectNat/latest/usage/provision.html)
|
|
33
|
+
|
|
34
|
+
4. **[Visibility Analysis](./examples/visibility_analysis.ipynb)**
|
|
35
|
+
Estimate visibility to nearby buildings from selected points.
|
|
36
|
+
📄 [See documentation](https://iduclub.github.io/ObjectNat/latest/usage/visibility.html)
|
|
37
|
+
|
|
38
|
+
5. **[Noise Simulation](./examples/noise_simulation.ipynb)**
|
|
39
|
+
Simulate noise propagation considering obstacles and environment.
|
|
40
|
+
📄 [See documentation](https://iduclub.github.io/ObjectNat/latest/usage/noise.html)
|
|
41
|
+
🔗 [Detailed theory in the Wiki](https://github.com/DDonnyy/ObjectNat/wiki/Noise-simulation)
|
|
42
|
+
|
|
43
|
+
6. **[Point Clusterization](./examples/point_clusterization.ipynb)**
|
|
44
|
+
Group nearby points into clusters and analyze service composition.
|
|
45
|
+
📄 [See documentation](https://iduclub.github.io/ObjectNat/latest/usage/clustering.html)
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## City graphs
|
|
50
|
+
|
|
51
|
+
To ensure optimal performance of ObjectNat's geospatial analysis functions, it's recommended to utilize urban graphs sourced from the [IduEdu](https://github.com/DDonnyy/IduEdu) library.
|
|
52
|
+
**IduEdu** is an open-source Python library designed for the creation and manipulation of complex city networks derived from OpenStreetMap data.
|
|
53
|
+
|
|
54
|
+
**IduEdu** can be installed with ``pip``:
|
|
55
|
+
```
|
|
56
|
+
pip install IduEdu
|
|
57
|
+
```
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
**ObjectNat** can be installed with ``pip``:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
pip install ObjectNat
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### Configuration changes
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from objectnat import config
|
|
74
|
+
|
|
75
|
+
config.change_logger_lvl('INFO') # To mute all debug msgs
|
|
76
|
+
config.set_enable_tqdm(False) # To mute all tqdm's progress bars
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Contacts
|
|
82
|
+
|
|
83
|
+
- [NCCR](https://actcognitive.org/) - National Center for Cognitive Research
|
|
84
|
+
- [IDU](https://idu.itmo.ru/) - Institute of Design and Urban Studies
|
|
85
|
+
- [Natalya Chichkova](https://t.me/nancy_nat) - project manager
|
|
86
|
+
- [Danila Oleynikov (Donny)](https://t.me/ddonny_dd) - lead software engineer
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Publications
|
|
91
|
+
|
|
92
|
+
_Coming soon._
|
|
@@ -1,69 +1,73 @@
|
|
|
1
|
-
[tool.poetry]
|
|
2
|
-
name = "ObjectNat"
|
|
3
|
-
version = "1.2.
|
|
4
|
-
description = "ObjectNat is an open-source library created for geospatial analysis created by IDU team"
|
|
5
|
-
license = "BSD-3-Clause"
|
|
6
|
-
authors = ["DDonnyy <63115678+DDonnyy@users.noreply.github.com>"]
|
|
7
|
-
readme = "README.md"
|
|
8
|
-
|
|
9
|
-
packages = [{ include = "objectnat", from = "src" }]
|
|
10
|
-
|
|
11
|
-
[tool.poetry.dependencies]
|
|
12
|
-
python = ">=3.10,<3.13"
|
|
13
|
-
numpy = "^2.1.3"
|
|
14
|
-
pandas = "^2.2.0"
|
|
15
|
-
geopandas = "^1.0.1"
|
|
16
|
-
tqdm = "^4.66.2"
|
|
17
|
-
pandarallel = "^1.6.5"
|
|
18
|
-
networkx = "^3.4.2"
|
|
19
|
-
scikit-learn = "^1.4.0"
|
|
20
|
-
loguru = "^0.7.3"
|
|
21
|
-
|
|
22
|
-
[tool.poetry.group.dev.dependencies]
|
|
23
|
-
iduedu = "^0.5.0"
|
|
24
|
-
pyarrow = "^19.0.1"
|
|
25
|
-
black = "^24.2.0"
|
|
26
|
-
pylint = "^3.0.3"
|
|
27
|
-
isort = "^5.13.2"
|
|
28
|
-
jupyter = "^1.0.0"
|
|
29
|
-
pytest = "^8.3.5"
|
|
30
|
-
pytest-cov = "^6.0.0"
|
|
31
|
-
pre-commit = "^4.2.0"
|
|
32
|
-
folium = "^0.19.5"
|
|
33
|
-
matplotlib = "^3.10.1"
|
|
34
|
-
mapclassify = "^2.8.1"
|
|
35
|
-
|
|
36
|
-
[
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
[
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
[tool.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
"too-many-
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "ObjectNat"
|
|
3
|
+
version = "1.2.2"
|
|
4
|
+
description = "ObjectNat is an open-source library created for geospatial analysis created by IDU team"
|
|
5
|
+
license = "BSD-3-Clause"
|
|
6
|
+
authors = ["DDonnyy <63115678+DDonnyy@users.noreply.github.com>"]
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
|
|
9
|
+
packages = [{ include = "objectnat", from = "src" }]
|
|
10
|
+
|
|
11
|
+
[tool.poetry.dependencies]
|
|
12
|
+
python = ">=3.10,<3.13"
|
|
13
|
+
numpy = "^2.1.3"
|
|
14
|
+
pandas = "^2.2.0"
|
|
15
|
+
geopandas = "^1.0.1"
|
|
16
|
+
tqdm = "^4.66.2"
|
|
17
|
+
pandarallel = "^1.6.5"
|
|
18
|
+
networkx = "^3.4.2"
|
|
19
|
+
scikit-learn = "^1.4.0"
|
|
20
|
+
loguru = "^0.7.3"
|
|
21
|
+
|
|
22
|
+
[tool.poetry.group.dev.dependencies]
|
|
23
|
+
iduedu = "^0.5.0"
|
|
24
|
+
pyarrow = "^19.0.1"
|
|
25
|
+
black = "^24.2.0"
|
|
26
|
+
pylint = "^3.0.3"
|
|
27
|
+
isort = "^5.13.2"
|
|
28
|
+
jupyter = "^1.0.0"
|
|
29
|
+
pytest = "^8.3.5"
|
|
30
|
+
pytest-cov = "^6.0.0"
|
|
31
|
+
pre-commit = "^4.2.0"
|
|
32
|
+
folium = "^0.19.5"
|
|
33
|
+
matplotlib = "^3.10.1"
|
|
34
|
+
mapclassify = "^2.8.1"
|
|
35
|
+
mkdocs = "^1.6.1"
|
|
36
|
+
mkdocstrings = {extras = ["python"], version = "^0.29.1"}
|
|
37
|
+
mkdocs-material = "^9.6.14"
|
|
38
|
+
mike = "^2.1.3"
|
|
39
|
+
|
|
40
|
+
[build-system]
|
|
41
|
+
requires = ["poetry-core"]
|
|
42
|
+
build-backend = "poetry.core.masonry.api"
|
|
43
|
+
|
|
44
|
+
[tool.black]
|
|
45
|
+
line-length = 120
|
|
46
|
+
target-version = ['py310']
|
|
47
|
+
|
|
48
|
+
[tool.pylint.format]
|
|
49
|
+
max-line-length = 120
|
|
50
|
+
expected-line-ending-format = "LF"
|
|
51
|
+
max-locals = 20
|
|
52
|
+
extension-pkg-allow-list = ["networkit"]
|
|
53
|
+
disable = [
|
|
54
|
+
"duplicate-code",
|
|
55
|
+
"too-many-positional-arguments",
|
|
56
|
+
"missing-module-docstring",
|
|
57
|
+
"missing-function-docstring",
|
|
58
|
+
"too-many-locals",
|
|
59
|
+
"too-many-branches",
|
|
60
|
+
"too-many-statements",
|
|
61
|
+
"too-many-arguments",
|
|
62
|
+
"cyclic-import"
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[tool.isort]
|
|
66
|
+
multi_line_output = 3
|
|
67
|
+
include_trailing_comma = true
|
|
68
|
+
force_grid_wrap = 0
|
|
69
|
+
use_parentheses = true
|
|
70
|
+
ensure_newline_before_comments = true
|
|
71
|
+
line_length = 120
|
|
72
|
+
split_on_trailing_comma = true
|
|
69
73
|
skip = ["__init__.py"]
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
"""
|
|
2
|
-
ObjectNat
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
from ._config import config
|
|
12
|
-
from ._api import *
|
|
13
|
-
from ._version import VERSION as __version__
|
|
1
|
+
"""
|
|
2
|
+
ObjectNat is an open-source library created for geospatial analysis created by IDU team.
|
|
3
|
+
|
|
4
|
+
Homepage https://github.com/DDonnyy/ObjectNat.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from ._config import config
|
|
8
|
+
from ._api import *
|
|
9
|
+
from ._version import VERSION as __version__
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "1.2.2"
|
|
@@ -1,108 +1,98 @@
|
|
|
1
|
-
from typing import Literal
|
|
2
|
-
|
|
3
|
-
import geopandas as gpd
|
|
4
|
-
import networkx as nx
|
|
5
|
-
import pandas as pd
|
|
6
|
-
from pyproj.exceptions import CRSError
|
|
7
|
-
from shapely import Point, concave_hull
|
|
8
|
-
|
|
9
|
-
from objectnat.methods.utils.graph_utils import get_closest_nodes_from_gdf, reverse_graph
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def get_graph_coverage(
|
|
13
|
-
gdf_to: gpd.GeoDataFrame,
|
|
14
|
-
nx_graph: nx.Graph,
|
|
15
|
-
weight_type: Literal["time_min", "length_meter"],
|
|
16
|
-
weight_value_cutoff: float = None,
|
|
17
|
-
zone: gpd.GeoDataFrame = None,
|
|
18
|
-
):
|
|
19
|
-
"""
|
|
20
|
-
Calculate coverage zones from source points through a graph network using Dijkstra's algorithm
|
|
21
|
-
and Voronoi diagrams.
|
|
22
|
-
|
|
23
|
-
The function works by:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Parameters
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
zone_coverages = voronois.sjoin(graph_nodes_gdf).dissolve(by="node_to").reset_index().drop(columns=["node"])
|
|
100
|
-
zone_coverages = zone_coverages.merge(
|
|
101
|
-
points.drop(columns="geometry"), left_on="node_to", right_on="nearest_node", how="inner"
|
|
102
|
-
).reset_index(drop=True)
|
|
103
|
-
zone_coverages.drop(columns=["node_to", "nearest_node"], inplace=True)
|
|
104
|
-
if zone is None:
|
|
105
|
-
zone = concave_hull(graph_nodes_gdf[~graph_nodes_gdf["node_to"].isna()].union_all(), ratio=0.5)
|
|
106
|
-
else:
|
|
107
|
-
zone = zone.to_crs(local_crs)
|
|
108
|
-
return zone_coverages.clip(zone).to_crs(original_crs)
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
import geopandas as gpd
|
|
4
|
+
import networkx as nx
|
|
5
|
+
import pandas as pd
|
|
6
|
+
from pyproj.exceptions import CRSError
|
|
7
|
+
from shapely import Point, concave_hull
|
|
8
|
+
|
|
9
|
+
from objectnat.methods.utils.graph_utils import get_closest_nodes_from_gdf, reverse_graph
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_graph_coverage(
|
|
13
|
+
gdf_to: gpd.GeoDataFrame,
|
|
14
|
+
nx_graph: nx.Graph,
|
|
15
|
+
weight_type: Literal["time_min", "length_meter"],
|
|
16
|
+
weight_value_cutoff: float = None,
|
|
17
|
+
zone: gpd.GeoDataFrame = None,
|
|
18
|
+
):
|
|
19
|
+
"""
|
|
20
|
+
Calculate coverage zones from source points through a graph network using Dijkstra's algorithm
|
|
21
|
+
and Voronoi diagrams.
|
|
22
|
+
|
|
23
|
+
The function works by:
|
|
24
|
+
1. Finding nearest graph nodes for each input point
|
|
25
|
+
2. Calculating all reachable nodes within cutoff distance using Dijkstra
|
|
26
|
+
3. Creating Voronoi polygons around graph nodes
|
|
27
|
+
4. Combining reachability information with Voronoi cells
|
|
28
|
+
5. Clipping results to specified zone boundary
|
|
29
|
+
|
|
30
|
+
Parameters:
|
|
31
|
+
gdf_to (gpd.GeoDataFrame):
|
|
32
|
+
Source points to which coverage is calculated.
|
|
33
|
+
nx_graph (nx.Graph):
|
|
34
|
+
NetworkX graph representing the transportation network.
|
|
35
|
+
weight_type (Literal["time_min", "length_meter"]):
|
|
36
|
+
Edge attribute to use as weight for path calculations.
|
|
37
|
+
weight_value_cutoff (float):
|
|
38
|
+
Maximum weight value for path calculations (e.g., max travel time/distance).
|
|
39
|
+
zone (gpd.GeoDataFrame):
|
|
40
|
+
Boundary polygon to clip the resulting coverage zones. If None, concave hull of reachable nodes will be used.
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
(gpd.GeoDataFrame):
|
|
44
|
+
GeoDataFrame with coverage zones polygons, each associated with its source point, returns in the same CRS
|
|
45
|
+
as original gdf_from.
|
|
46
|
+
|
|
47
|
+
Notes:
|
|
48
|
+
- The graph must have a valid CRS attribute in its graph properties
|
|
49
|
+
- MultiGraph/MultiDiGraph inputs will be converted to simple Graph/DiGraph
|
|
50
|
+
"""
|
|
51
|
+
original_crs = gdf_to.crs
|
|
52
|
+
try:
|
|
53
|
+
local_crs = nx_graph.graph["crs"]
|
|
54
|
+
except KeyError as exc:
|
|
55
|
+
raise ValueError("Graph does not have crs attribute") from exc
|
|
56
|
+
|
|
57
|
+
try:
|
|
58
|
+
points = gdf_to.copy()
|
|
59
|
+
points.to_crs(local_crs, inplace=True)
|
|
60
|
+
except CRSError as e:
|
|
61
|
+
raise CRSError(f"Graph crs ({local_crs}) has invalid format.") from e
|
|
62
|
+
|
|
63
|
+
nx_graph, reversed_graph = reverse_graph(nx_graph, weight_type)
|
|
64
|
+
|
|
65
|
+
points.geometry = points.representative_point()
|
|
66
|
+
|
|
67
|
+
_, nearest_nodes = get_closest_nodes_from_gdf(points, nx_graph)
|
|
68
|
+
|
|
69
|
+
points["nearest_node"] = nearest_nodes
|
|
70
|
+
|
|
71
|
+
nearest_paths = nx.multi_source_dijkstra_path(
|
|
72
|
+
reversed_graph, nearest_nodes, weight=weight_type, cutoff=weight_value_cutoff
|
|
73
|
+
)
|
|
74
|
+
reachable_nodes = list(nearest_paths.keys())
|
|
75
|
+
graph_points = pd.DataFrame(
|
|
76
|
+
data=[{"node": node, "geometry": Point(data["x"], data["y"])} for node, data in nx_graph.nodes(data=True)]
|
|
77
|
+
).set_index("node")
|
|
78
|
+
nearest_nodes = pd.DataFrame(
|
|
79
|
+
data=[path[0] for path in nearest_paths.values()], index=reachable_nodes, columns=["node_to"]
|
|
80
|
+
)
|
|
81
|
+
graph_nodes_gdf = gpd.GeoDataFrame(
|
|
82
|
+
graph_points.merge(nearest_nodes, left_index=True, right_index=True, how="left"),
|
|
83
|
+
geometry="geometry",
|
|
84
|
+
crs=local_crs,
|
|
85
|
+
)
|
|
86
|
+
graph_nodes_gdf["node_to"] = graph_nodes_gdf["node_to"].fillna("non_reachable")
|
|
87
|
+
voronois = gpd.GeoDataFrame(geometry=graph_nodes_gdf.voronoi_polygons(), crs=local_crs)
|
|
88
|
+
graph_nodes_gdf = graph_nodes_gdf[graph_nodes_gdf["node_to"] != "non_reachable"]
|
|
89
|
+
zone_coverages = voronois.sjoin(graph_nodes_gdf).dissolve(by="node_to").reset_index().drop(columns=["node"])
|
|
90
|
+
zone_coverages = zone_coverages.merge(
|
|
91
|
+
points.drop(columns="geometry"), left_on="node_to", right_on="nearest_node", how="inner"
|
|
92
|
+
).reset_index(drop=True)
|
|
93
|
+
zone_coverages.drop(columns=["node_to", "nearest_node"], inplace=True)
|
|
94
|
+
if zone is None:
|
|
95
|
+
zone = concave_hull(graph_nodes_gdf[~graph_nodes_gdf["node_to"].isna()].union_all(), ratio=0.5)
|
|
96
|
+
else:
|
|
97
|
+
zone = zone.to_crs(local_crs)
|
|
98
|
+
return zone_coverages.clip(zone).to_crs(original_crs)
|