voxcity 0.2.0__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.
- voxcity-0.2.0/AUTHORS.rst +13 -0
- voxcity-0.2.0/CONTRIBUTING.rst +137 -0
- voxcity-0.2.0/HISTORY.rst +8 -0
- voxcity-0.2.0/LICENSE +21 -0
- voxcity-0.2.0/MANIFEST.in +11 -0
- voxcity-0.2.0/PKG-INFO +436 -0
- voxcity-0.2.0/README.md +381 -0
- voxcity-0.2.0/docs/Makefile +26 -0
- voxcity-0.2.0/docs/archive/README.rst +39 -0
- voxcity-0.2.0/docs/authors.rst +1 -0
- voxcity-0.2.0/docs/conf.py +241 -0
- voxcity-0.2.0/docs/index.rst +20 -0
- voxcity-0.2.0/docs/make.bat +36 -0
- voxcity-0.2.0/pyproject.toml +83 -0
- voxcity-0.2.0/setup.cfg +4 -0
- voxcity-0.2.0/src/voxcity/__init__.py +8 -0
- voxcity-0.2.0/src/voxcity/download/__init__.py +8 -0
- voxcity-0.2.0/src/voxcity/download/eubucco.py +325 -0
- voxcity-0.2.0/src/voxcity/download/gee.py +395 -0
- voxcity-0.2.0/src/voxcity/download/mbfp.py +104 -0
- voxcity-0.2.0/src/voxcity/download/oemj.py +208 -0
- voxcity-0.2.0/src/voxcity/download/omt.py +220 -0
- voxcity-0.2.0/src/voxcity/download/osm.py +649 -0
- voxcity-0.2.0/src/voxcity/download/overture.py +213 -0
- voxcity-0.2.0/src/voxcity/download/utils.py +44 -0
- voxcity-0.2.0/src/voxcity/file/__init_.py +4 -0
- voxcity-0.2.0/src/voxcity/file/envimet.py +570 -0
- voxcity-0.2.0/src/voxcity/file/geojson.py +528 -0
- voxcity-0.2.0/src/voxcity/file/magicavoxel.py +187 -0
- voxcity-0.2.0/src/voxcity/file/obj.py +530 -0
- voxcity-0.2.0/src/voxcity/geo/__init_.py +3 -0
- voxcity-0.2.0/src/voxcity/geo/draw.py +225 -0
- voxcity-0.2.0/src/voxcity/geo/grid.py +885 -0
- voxcity-0.2.0/src/voxcity/geo/utils.py +561 -0
- voxcity-0.2.0/src/voxcity/sim/__init_.py +1 -0
- voxcity-0.2.0/src/voxcity/sim/view.py +622 -0
- voxcity-0.2.0/src/voxcity/utils/__init_.py +2 -0
- voxcity-0.2.0/src/voxcity/utils/lc.py +287 -0
- voxcity-0.2.0/src/voxcity/utils/visualization.py +1005 -0
- voxcity-0.2.0/src/voxcity/voxcity.py +638 -0
- voxcity-0.2.0/src/voxcity.egg-info/PKG-INFO +436 -0
- voxcity-0.2.0/src/voxcity.egg-info/SOURCES.txt +45 -0
- voxcity-0.2.0/src/voxcity.egg-info/dependency_links.txt +1 -0
- voxcity-0.2.0/src/voxcity.egg-info/requires.txt +38 -0
- voxcity-0.2.0/src/voxcity.egg-info/top_level.txt +1 -0
- voxcity-0.2.0/tests/__init__.py +1 -0
- voxcity-0.2.0/tests/voxelcity.py +21 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
.. highlight:: shell
|
|
2
|
+
|
|
3
|
+
============
|
|
4
|
+
Contributing
|
|
5
|
+
============
|
|
6
|
+
|
|
7
|
+
Contributions are welcome, and they are greatly appreciated! Every little bit
|
|
8
|
+
helps, and credit will always be given.
|
|
9
|
+
|
|
10
|
+
You can contribute in many ways:
|
|
11
|
+
|
|
12
|
+
Types of Contributions
|
|
13
|
+
----------------------
|
|
14
|
+
|
|
15
|
+
Report Bugs
|
|
16
|
+
~~~~~~~~~~~
|
|
17
|
+
|
|
18
|
+
Report bugs at https://github.com/kunifujiwara/voxelcity/issues.
|
|
19
|
+
|
|
20
|
+
If you are reporting a bug, please include:
|
|
21
|
+
|
|
22
|
+
* Your operating system name and version.
|
|
23
|
+
* Any details about your local setup that might be helpful in troubleshooting.
|
|
24
|
+
* Detailed steps to reproduce the bug.
|
|
25
|
+
|
|
26
|
+
Fix Bugs
|
|
27
|
+
~~~~~~~~
|
|
28
|
+
|
|
29
|
+
Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
|
|
30
|
+
wanted" is open to whoever wants to implement it.
|
|
31
|
+
|
|
32
|
+
Implement Features
|
|
33
|
+
~~~~~~~~~~~~~~~~~~
|
|
34
|
+
|
|
35
|
+
Look through the GitHub issues for features. Anything tagged with "enhancement"
|
|
36
|
+
and "help wanted" is open to whoever wants to implement it.
|
|
37
|
+
|
|
38
|
+
Write Documentation
|
|
39
|
+
~~~~~~~~~~~~~~~~~~~
|
|
40
|
+
|
|
41
|
+
3D City Model Generator could always use more documentation, whether as part of the
|
|
42
|
+
official 3D City Model Generator docs, in docstrings, or even on the web in blog posts,
|
|
43
|
+
articles, and such.
|
|
44
|
+
|
|
45
|
+
Submit Feedback
|
|
46
|
+
~~~~~~~~~~~~~~~
|
|
47
|
+
|
|
48
|
+
The best way to send feedback is to file an issue at https://github.com/kunifujiwara/voxelcity/issues.
|
|
49
|
+
|
|
50
|
+
If you are proposing a feature:
|
|
51
|
+
|
|
52
|
+
* Explain in detail how it would work.
|
|
53
|
+
* Keep the scope as narrow as possible, to make it easier to implement.
|
|
54
|
+
* Remember that this is a volunteer-driven project, and that contributions
|
|
55
|
+
are welcome :)
|
|
56
|
+
|
|
57
|
+
Get Started!
|
|
58
|
+
------------
|
|
59
|
+
|
|
60
|
+
Ready to contribute? Here's how to set up `voxelcity` for local development.
|
|
61
|
+
|
|
62
|
+
1. Fork the `voxelcity` repo on GitHub.
|
|
63
|
+
2. Clone your fork locally::
|
|
64
|
+
|
|
65
|
+
$ git clone git@github.com:your_name_here/voxelcity.git
|
|
66
|
+
|
|
67
|
+
3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
|
|
68
|
+
|
|
69
|
+
$ mkvirtualenv voxelcity
|
|
70
|
+
$ cd voxelcity/
|
|
71
|
+
$ python setup.py develop
|
|
72
|
+
|
|
73
|
+
4. Create a branch for local development::
|
|
74
|
+
|
|
75
|
+
$ git checkout -b name-of-your-bugfix-or-feature
|
|
76
|
+
|
|
77
|
+
Now you can make your changes locally.
|
|
78
|
+
|
|
79
|
+
5. When you're done making changes, check that your changes pass flake8 and the
|
|
80
|
+
tests, including testing other Python versions with tox::
|
|
81
|
+
|
|
82
|
+
$ make lint
|
|
83
|
+
$ make test
|
|
84
|
+
Or
|
|
85
|
+
$ make test-all
|
|
86
|
+
|
|
87
|
+
To get flake8 and tox, just pip install them into your virtualenv.
|
|
88
|
+
|
|
89
|
+
6. Commit your changes and push your branch to GitHub::
|
|
90
|
+
|
|
91
|
+
$ git add .
|
|
92
|
+
$ git commit -m "Your detailed description of your changes."
|
|
93
|
+
$ git push origin name-of-your-bugfix-or-feature
|
|
94
|
+
|
|
95
|
+
7. Submit a pull request through the GitHub website.
|
|
96
|
+
|
|
97
|
+
Pull Request Guidelines
|
|
98
|
+
-----------------------
|
|
99
|
+
|
|
100
|
+
Before you submit a pull request, check that it meets these guidelines:
|
|
101
|
+
|
|
102
|
+
1. The pull request should include tests.
|
|
103
|
+
2. If the pull request adds functionality, the docs should be updated. Put
|
|
104
|
+
your new functionality into a function with a docstring, and add the
|
|
105
|
+
feature to the list in README.rst.
|
|
106
|
+
3. The pull request should work for Python 3.5, 3.6, 3.7 and 3.8, and for PyPy. Check
|
|
107
|
+
https://travis-ci.com/kunifujiwara/voxelcity/pull_requests
|
|
108
|
+
and make sure that the tests pass for all supported Python versions.
|
|
109
|
+
|
|
110
|
+
Tips
|
|
111
|
+
----
|
|
112
|
+
|
|
113
|
+
To run a subset of tests::
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
$ python -m unittest tests.test_voxelcity
|
|
117
|
+
|
|
118
|
+
Deploying
|
|
119
|
+
---------
|
|
120
|
+
|
|
121
|
+
A reminder for the maintainers on how to deploy.
|
|
122
|
+
Make sure all your changes are committed (including an entry in HISTORY.rst).
|
|
123
|
+
Then run::
|
|
124
|
+
|
|
125
|
+
$ bump2version patch # possible: major / minor / patch
|
|
126
|
+
$ git push
|
|
127
|
+
$ git push --tags
|
|
128
|
+
|
|
129
|
+
Travis will then deploy to PyPI if tests pass.
|
|
130
|
+
|
|
131
|
+
Code of Conduct
|
|
132
|
+
---------------
|
|
133
|
+
|
|
134
|
+
Please note that this project is released with a `Contributor Code of Conduct`_.
|
|
135
|
+
By participating in this project you agree to abide by its terms.
|
|
136
|
+
|
|
137
|
+
.. _`Contributor Code of Conduct`: CODE_OF_CONDUCT.rst
|
voxcity-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022, winstonyym
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
include AUTHORS.rst
|
|
2
|
+
include CONTRIBUTING.rst
|
|
3
|
+
include HISTORY.rst
|
|
4
|
+
include LICENSE
|
|
5
|
+
include README.rst
|
|
6
|
+
|
|
7
|
+
recursive-include tests *
|
|
8
|
+
recursive-exclude * __pycache__
|
|
9
|
+
recursive-exclude * *.py[co]
|
|
10
|
+
|
|
11
|
+
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
|
voxcity-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: voxcity
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: voxcity is an easy and one-stop tool to output 3d city models for microclimate simulation by integrating multiple geospatial open-data
|
|
5
|
+
Author-email: Kunihiko Fujiwara <kunihiko@nus.edu.sg>
|
|
6
|
+
Maintainer-email: Kunihiko Fujiwara <kunihiko@nus.edu.sg>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: bugs, https://github.com/kunifujiwara/voxcity/issues
|
|
9
|
+
Project-URL: changelog, https://github.com/kunifujiwara/voxcity/blob/master/changelog.md
|
|
10
|
+
Project-URL: homepage, https://github.com/kunifujiwara/voxcity
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Requires-Python: <3.13,>=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
License-File: AUTHORS.rst
|
|
18
|
+
Requires-Dist: typer
|
|
19
|
+
Requires-Dist: pandas
|
|
20
|
+
Requires-Dist: requests
|
|
21
|
+
Requires-Dist: pyproj
|
|
22
|
+
Requires-Dist: ipyleaflet
|
|
23
|
+
Requires-Dist: geopandas
|
|
24
|
+
Requires-Dist: rasterio==1.3.11
|
|
25
|
+
Requires-Dist: shapely
|
|
26
|
+
Requires-Dist: gdown
|
|
27
|
+
Requires-Dist: numpy
|
|
28
|
+
Requires-Dist: matplotlib
|
|
29
|
+
Requires-Dist: contextily
|
|
30
|
+
Requires-Dist: fiona
|
|
31
|
+
Requires-Dist: rtree
|
|
32
|
+
Requires-Dist: plotly
|
|
33
|
+
Requires-Dist: tqdm
|
|
34
|
+
Requires-Dist: scipy
|
|
35
|
+
Requires-Dist: affine
|
|
36
|
+
Requires-Dist: earthengine-api
|
|
37
|
+
Requires-Dist: geemap
|
|
38
|
+
Requires-Dist: rio-cogeo
|
|
39
|
+
Requires-Dist: geopy
|
|
40
|
+
Requires-Dist: py-vox-io
|
|
41
|
+
Requires-Dist: mapbox_vector_tile
|
|
42
|
+
Requires-Dist: numba
|
|
43
|
+
Requires-Dist: reverse_geocoder
|
|
44
|
+
Requires-Dist: pycountry
|
|
45
|
+
Requires-Dist: osm2geojson
|
|
46
|
+
Requires-Dist: seaborn
|
|
47
|
+
Requires-Dist: overturemaps
|
|
48
|
+
Requires-Dist: protobuf==3.20.3
|
|
49
|
+
Requires-Dist: timezonefinder
|
|
50
|
+
Provides-Extra: dev
|
|
51
|
+
Requires-Dist: coverage; extra == "dev"
|
|
52
|
+
Requires-Dist: mypy; extra == "dev"
|
|
53
|
+
Requires-Dist: pytest; extra == "dev"
|
|
54
|
+
Requires-Dist: ruff; extra == "dev"
|
|
55
|
+
|
|
56
|
+
[](https://pypi.python.org/pypi/voxcity)
|
|
57
|
+
[](https://pypi.org/project/voxcity/)
|
|
58
|
+
[](https://colab.research.google.com/drive/1Lofd3RawKMr6QuUsamGaF48u2MN0hfrP?usp=sharing)
|
|
59
|
+
[](https://pypi.org/project/voxcity/)
|
|
60
|
+
[](https://pepy.tech/project/voxcity)
|
|
61
|
+
<!-- [](https://creativecommons.org/licenses/by-sa/4.0/) -->
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# VoxCity
|
|
65
|
+
|
|
66
|
+
**VoxCity** is a Python package that facilitates the creation of voxel-based 3D urban environments and related geospatial analyses. It integrates various geospatial datasets—such as building footprints, land cover, canopy height, and digital elevation models (DEMs)—to generate 2D and 3D representations of urban areas. It can export data in formats compatible with popular simulation tools like ENVI-MET, as well as visualization tools like MagicaVoxel, and supports simulations such as sky view index and green view index calculations.
|
|
67
|
+
|
|
68
|
+
<!-- <p align="center">
|
|
69
|
+
<picture>
|
|
70
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/kunifujiwara/VoxCity/blob/main/images/concept.png">
|
|
71
|
+
<img src="https://github.com/kunifujiwara/VoxCity/blob/main/images/concept.png" alt="Conceptual Diagram of voxcity" width="800">
|
|
72
|
+
</picture>
|
|
73
|
+
</p> -->
|
|
74
|
+
<p align="center">
|
|
75
|
+
<img src="https://raw.githubusercontent.com/kunifujiwara/VoxCity/main/images/concept.png" alt="Conceptual Diagram of voxcity" width="800">
|
|
76
|
+
</p>
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
## Key Features
|
|
80
|
+
|
|
81
|
+
- **Integration of Multiple Data Sources:**
|
|
82
|
+
Combines building footprints, land cover data, canopy height maps, and DEMs to generate a consistent 3D voxel representation of an urban scene.
|
|
83
|
+
|
|
84
|
+
- **Flexible Input Sources:**
|
|
85
|
+
Supports various building and terrain data sources including:
|
|
86
|
+
- Building Footprints: OpenStreetMap, Overture, EUBUCCO, Microsoft Building Footprints, OpenMapTiles, Open Building 2.5D
|
|
87
|
+
- Land Cover: UrbanWatch, OpenEarthMap Japan, ESA WorldCover, ESRI Land Cover, Dynamic World, OpenStreetMap
|
|
88
|
+
- Canopy Height: High Resolution 1m Global Canopy Height Maps, ETH Global Sentinel-2 10m
|
|
89
|
+
- DEM: DeltaDTM, FABDEM, NASA, COPERNICUS, and more
|
|
90
|
+
|
|
91
|
+
*Detailed information about each data source can be found in the [References of Data Sources](#references-of-data-sources) section.*
|
|
92
|
+
|
|
93
|
+
- **Customizable Domain and Resolution:**
|
|
94
|
+
Easily define a target area by drawing a rectangle on a map or specifying center coordinates and dimensions. Adjust the mesh size to meet resolution needs.
|
|
95
|
+
|
|
96
|
+
- **Integration with Earth Engine:**
|
|
97
|
+
Leverages Google Earth Engine for large-scale geospatial data processing (authentication and project setup required).
|
|
98
|
+
|
|
99
|
+
- **Output Formats:**
|
|
100
|
+
- **ENVI-MET**: Export INX and EDB files suitable for ENVI-MET microclimate simulations.
|
|
101
|
+
- **MagicaVoxel**: Export vox files for 3D editing and visualization in MagicaVoxel.
|
|
102
|
+
- **OBJ**: Export wavefront OBJ for rendering and integration into other workflows.
|
|
103
|
+
|
|
104
|
+
- **Analytical Tools:**
|
|
105
|
+
- **View Index Simulations**: Compute sky view index (SVI) and green view index (GVI) from a specified viewpoint.
|
|
106
|
+
- **Landmark Visibility Maps**: Assess the visibility of selected landmarks within the voxelized environment.
|
|
107
|
+
|
|
108
|
+
## Installation
|
|
109
|
+
|
|
110
|
+
Make sure you have Python 3.12 installed. Install voxcity with:
|
|
111
|
+
|
|
112
|
+
### For Local Environment
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
conda create --name voxcity python=3.12
|
|
116
|
+
conda activate voxcity
|
|
117
|
+
conda install -c conda-forge gdal
|
|
118
|
+
pip install voxcity
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### For Google Colab
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
!pip install voxcity
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Setup for Earth Engine
|
|
128
|
+
|
|
129
|
+
To use Earth Engine data, set up your Earth Engine enabled Cloud Project by following the instructions here:
|
|
130
|
+
https://developers.google.com/earth-engine/cloud/earthengine_cloud_project_setup
|
|
131
|
+
|
|
132
|
+
After setting up, authenticate and initialize Earth Engine:
|
|
133
|
+
|
|
134
|
+
### For Local Environment
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
earthengine authenticate
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### For Google Colab
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
# Click displayed link, generate token, copy and paste the token
|
|
144
|
+
!earthengine authenticate --auth_mode=notebook
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Usage Overview
|
|
148
|
+
|
|
149
|
+
### 1. Authenticate Earth Engine
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
import ee
|
|
153
|
+
ee.Authenticate()
|
|
154
|
+
ee.Initialize(project='your-project-id')
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 2. Define Target Area
|
|
158
|
+
|
|
159
|
+
You can define your target area in three ways:
|
|
160
|
+
|
|
161
|
+
#### Option 1: Direct Coordinate Input
|
|
162
|
+
Define the target area by directly specifying the coordinates of the rectangle vertices.
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
rectangle_vertices = [
|
|
166
|
+
(47.59830044521263, -122.33587348582083), # Southwest corner (latitude, longitude)
|
|
167
|
+
(47.60279755390168, -122.33587348582083), # Northwest corner (latitude, longitude)
|
|
168
|
+
(47.60279755390168, -122.32922451417917), # Northeast corner (latitude, longitude)
|
|
169
|
+
(47.59830044521263, -122.32922451417917) # Southeast corner (latitude, longitude)
|
|
170
|
+
]
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
#### Option 2: Draw a Rectangle (for Jupyter Notebook)
|
|
174
|
+
Use the GUI map interface to draw a rectangular domain of interest.
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
from voxcity.geo.draw import draw_rectangle_map_cityname
|
|
178
|
+
|
|
179
|
+
cityname = "tokyo"
|
|
180
|
+
m, rectangle_vertices = draw_rectangle_map_cityname(cityname, zoom=15)
|
|
181
|
+
m
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### Option 3: Specify Center and Dimensions (for Jupyter Notebook)
|
|
185
|
+
Choose the width and height in meters and select the center point on the map.
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
from voxcity.geo.draw import center_location_map_cityname
|
|
189
|
+
|
|
190
|
+
width = 500
|
|
191
|
+
height = 500
|
|
192
|
+
m, rectangle_vertices = center_location_map_cityname(cityname, width, height, zoom=15)
|
|
193
|
+
m
|
|
194
|
+
```
|
|
195
|
+
<p align="center">
|
|
196
|
+
<img src="https://raw.githubusercontent.com/kunifujiwara/VoxCity/main/images/draw_rect.png" alt="Draw Rectangle on Map GUI" width="400">
|
|
197
|
+
</p>
|
|
198
|
+
|
|
199
|
+
### 3. Set Parameters
|
|
200
|
+
|
|
201
|
+
Define data sources and mesh size (m):
|
|
202
|
+
|
|
203
|
+
```python
|
|
204
|
+
building_source = 'OpenStreetMap' # Building footprint and height data source
|
|
205
|
+
land_cover_source = 'OpenStreetMap' # Land cover classification data source
|
|
206
|
+
canopy_height_source = 'High Resolution 1m Global Canopy Height Maps' # Tree canopy height data source
|
|
207
|
+
dem_source = 'DeltaDTM' # Digital elevation model data source
|
|
208
|
+
meshsize = 5 # Grid cell size in meters
|
|
209
|
+
|
|
210
|
+
kwargs = {
|
|
211
|
+
"output_dir": "output", # Directory to save output files
|
|
212
|
+
"dem_interpolation": True # Enable DEM interpolation
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### 4. Get voxcity Output
|
|
217
|
+
|
|
218
|
+
Generate voxel data grids and corresponding building geoJSON:
|
|
219
|
+
|
|
220
|
+
```python
|
|
221
|
+
from voxcity import get_voxcity
|
|
222
|
+
|
|
223
|
+
voxcity_grid, building_height_grid, building_min_height_grid, \
|
|
224
|
+
building_id_grid, canopy_height_grid, land_cover_grid, dem_grid, \
|
|
225
|
+
building_geojson = get_voxcity(
|
|
226
|
+
rectangle_vertices,
|
|
227
|
+
building_source,
|
|
228
|
+
land_cover_source,
|
|
229
|
+
canopy_height_source,
|
|
230
|
+
dem_source,
|
|
231
|
+
meshsize,
|
|
232
|
+
**kwargs
|
|
233
|
+
)
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### 5. Exporting Files
|
|
237
|
+
|
|
238
|
+
#### ENVI-MET INX/EDB Files:
|
|
239
|
+
[ENVI-MET](https://www.envi-met.com/) is an advanced microclimate simulation software specialized in modeling urban environments. It simulates the interactions between buildings, vegetation, and various climate parameters like temperature, wind flow, humidity, and radiation. The software is used widely in urban planning, architecture, and environmental studies (Commercial, offers educational licenses).
|
|
240
|
+
|
|
241
|
+
```python
|
|
242
|
+
from voxcity.file.envimet import export_inx, generate_edb_file
|
|
243
|
+
|
|
244
|
+
envimet_kwargs = {
|
|
245
|
+
"output_directory": "output", # Directory where output files will be saved
|
|
246
|
+
"author_name": "your name", # Name of the model author
|
|
247
|
+
"model_description": "generated with voxcity", # Description text for the model
|
|
248
|
+
"domain_building_max_height_ratio": 2, # Maximum ratio between domain height and tallest building height
|
|
249
|
+
"useTelescoping_grid": True, # Enable telescoping grid for better computational efficiency
|
|
250
|
+
"verticalStretch": 20, # Vertical grid stretching factor (%)
|
|
251
|
+
"min_grids_Z": 20, # Minimum number of vertical grid cells
|
|
252
|
+
"lad": 1.0 # Leaf Area Density (m2/m3) for vegetation modeling
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export_inx(building_height_grid, building_id_grid, canopy_height_grid, land_cover_grid, dem_grid, meshsize, land_cover_source, rectangle_vertices, **envimet_kwargs)
|
|
256
|
+
generate_edb_file(**envimet_kwargs)
|
|
257
|
+
```
|
|
258
|
+
<p align="center">
|
|
259
|
+
<img src="https://raw.githubusercontent.com/kunifujiwara/VoxCity/main/images/envimet.png" alt="Generated 3D City Model on Envi-MET GUI" width="600">
|
|
260
|
+
</p>
|
|
261
|
+
<p align="center">
|
|
262
|
+
<em>Example Output Exported in INX and Inported in ENVI-met</em>
|
|
263
|
+
</p>
|
|
264
|
+
|
|
265
|
+
#### OBJ Files:
|
|
266
|
+
|
|
267
|
+
```python
|
|
268
|
+
from voxcity.file.obj import export_obj
|
|
269
|
+
|
|
270
|
+
output_directory = "output" # Directory where output files will be saved
|
|
271
|
+
output_file_name = "voxcity" # Base name for the output OBJ file
|
|
272
|
+
export_obj(voxcity_grid, output_directory, output_file_name, meshsize)
|
|
273
|
+
```
|
|
274
|
+
The generated OBJ files can be opened and rendered in the following 3D visualization software:
|
|
275
|
+
|
|
276
|
+
- [Twinmotion](https://www.twinmotion.com/): Real-time visualization tool (Free for personal use)
|
|
277
|
+
- [Blender](https://www.blender.org/): Professional-grade 3D creation suite (Free)
|
|
278
|
+
- [Rhino](https://www.rhino3d.com/): Professional 3D modeling software (Commercial, offers educational licenses)
|
|
279
|
+
|
|
280
|
+
<p align="center">
|
|
281
|
+
<img src="https://raw.githubusercontent.com/kunifujiwara/VoxCity/main/images/obj.png" alt="OBJ 3D City Model Rendered in Rhino" width="600">
|
|
282
|
+
</p>
|
|
283
|
+
<p align="center">
|
|
284
|
+
<em>Example Output Exported in OBJ and Rendered in MagicaVoxel</em>
|
|
285
|
+
</p>
|
|
286
|
+
|
|
287
|
+
#### MagicaVoxel VOX Files:
|
|
288
|
+
|
|
289
|
+
[MagicaVoxel](https://ephtracy.github.io/) is a lightweight and user-friendly voxel art editor. It allows users to create, edit, and render voxel-based 3D models with an intuitive interface, making it perfect for modifying and visualizing voxelized city models. The software is free and available for Windows and Mac.
|
|
290
|
+
|
|
291
|
+
```python
|
|
292
|
+
from voxcity.file.magicavoxel import export_magicavoxel_vox
|
|
293
|
+
|
|
294
|
+
output_path = "output"
|
|
295
|
+
base_filename = "voxcity"
|
|
296
|
+
export_magicavoxel_vox(voxcity_grid, output_path, base_filename=base_filename)
|
|
297
|
+
```
|
|
298
|
+
<p align="center">
|
|
299
|
+
<img src="https://raw.githubusercontent.com/kunifujiwara/VoxCity/main/images/vox.png" alt="Generated 3D City Model on MagicaVoxel GUI" width="600">
|
|
300
|
+
</p>
|
|
301
|
+
<p align="center">
|
|
302
|
+
<em>Example Output Exported in VOX and Rendered in MagicaVoxel</em>
|
|
303
|
+
</p>
|
|
304
|
+
|
|
305
|
+
### 6. Additional Use Cases
|
|
306
|
+
|
|
307
|
+
#### Compute Green View Index (GVI) and Sky View Index (SVI):
|
|
308
|
+
|
|
309
|
+
```python
|
|
310
|
+
from voxcity.sim.view import get_view_index
|
|
311
|
+
|
|
312
|
+
view_kwargs = {
|
|
313
|
+
"view_point_height": 1.5, # Height of observer viewpoint in meters
|
|
314
|
+
"dem_grid": dem_grid, # Digital elevation model grid
|
|
315
|
+
"colormap": "viridis", # Colormap for visualization
|
|
316
|
+
"obj_export": True, # Whether to export as OBJ file
|
|
317
|
+
"output_directory": "output", # Directory to save output files
|
|
318
|
+
"output_file_name": "gvi" # Base filename for outputs
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
# Compute Green View Index using mode='green'
|
|
322
|
+
gvi_grid = get_view_index(voxcity_grid, meshsize, mode='green', **view_kwargs)
|
|
323
|
+
|
|
324
|
+
# Adjust parameters for Sky View Index
|
|
325
|
+
view_kwargs["colormap"] = "BuPu_r"
|
|
326
|
+
view_kwargs["output_file_name"] = "svi"
|
|
327
|
+
view_kwargs["elevation_min_degrees"] = 0 # Start ray-tracing from the horizon
|
|
328
|
+
|
|
329
|
+
# Compute Sky View Index using mode='sky'
|
|
330
|
+
svi_grid = get_view_index(voxcity_grid, meshsize, mode='sky', **view_kwargs)
|
|
331
|
+
```
|
|
332
|
+
<p align="center">
|
|
333
|
+
<img src="https://raw.githubusercontent.com/kunifujiwara/VoxCity/main/images/view_index.png" alt="View Index Maps Rendered in Rhino" width="800">
|
|
334
|
+
</p>
|
|
335
|
+
<p align="center">
|
|
336
|
+
<em>Example Results Saved as OBJ and Rendered in Rhino</em>
|
|
337
|
+
</p>
|
|
338
|
+
|
|
339
|
+
#### Landmark Visibility Map:
|
|
340
|
+
|
|
341
|
+
```python
|
|
342
|
+
from voxcity.sim.view import get_landmark_visibility_map
|
|
343
|
+
|
|
344
|
+
# Dictionary of parameters for landmark visibility analysis
|
|
345
|
+
landmark_kwargs = {
|
|
346
|
+
"view_point_height": 1.5, # Height of observer viewpoint in meters
|
|
347
|
+
"rectangle_vertices": rectangle_vertices, # Vertices defining simulation domain boundary
|
|
348
|
+
"dem_grid": dem_grid, # Digital elevation model grid
|
|
349
|
+
"colormap": "cool", # Colormap for visualization
|
|
350
|
+
"obj_export": True, # Whether to export as OBJ file
|
|
351
|
+
"output_directory": "output", # Directory to save output files
|
|
352
|
+
"output_file_name": "landmark_visibility" # Base filename for outputs
|
|
353
|
+
}
|
|
354
|
+
landmark_vis_map = get_landmark_visibility_map(voxcity_grid, building_id_grid, building_geojson, meshsize, **landmark_kwargs)
|
|
355
|
+
```
|
|
356
|
+
<p align="center">
|
|
357
|
+
<img src="https://raw.githubusercontent.com/kunifujiwara/VoxCity/main/images/landmark.png" alt="Landmark Visibility Map Rendered in Rhino" width="500">
|
|
358
|
+
</p>
|
|
359
|
+
<p align="center">
|
|
360
|
+
<em>Example Result Saved as OBJ and Rendered in Rhino</em>
|
|
361
|
+
</p>
|
|
362
|
+
|
|
363
|
+
## References of Data Sources
|
|
364
|
+
|
|
365
|
+
### Building
|
|
366
|
+
|
|
367
|
+
| Dataset | Spatial Coverage | Source/Data Acquisition |
|
|
368
|
+
|---------|------------------|------------------------|
|
|
369
|
+
| [OpenStreetMap](https://www.openstreetmap.org) | Worldwide (24% completeness in city centers) | Volunteered / updated continuously |
|
|
370
|
+
| [Global ML Building Footprints](https://github.com/microsoft/GlobalMLBuildingFootprints) | North America, Europe, Australia | Prediction from satellite or aerial imagery / 2018-2019 for majority of the input imagery |
|
|
371
|
+
| [Open Buildings 2.5D Temporal Dataset](https://sites.research.google/gr/open-buildings/temporal/) | Africa, Latin America, and South and Southeast Asia | Prediction from satellite imagery / 2016-2023 |
|
|
372
|
+
| [EUBUCCO v0.1](https://eubucco.com/) | 27 EU countries and Switzerland (378 regions and 40,829 cities) | OpenStreetMap, government datasets / 2003-2021 (majority is after 2019) |
|
|
373
|
+
| [UT-GLOBUS](https://zenodo.org/records/11156602) | Worldwide (more than 1200 cities or locales) | Prediction from building footprints, population, spaceborne nDSM / not provided |
|
|
374
|
+
| [Overture Maps](https://overturemaps.org/) | Worldwide | OpenStreetMap, Esri Community Maps Program, Google Open Buildings, etc. / updated continuously |
|
|
375
|
+
|
|
376
|
+
### Tree Canopy Height
|
|
377
|
+
|
|
378
|
+
| Dataset | Coverage | Resolution | Source/Data Acquisition |
|
|
379
|
+
|---------|-----------|------------|------------------------|
|
|
380
|
+
| [High Resolution 1m Global Canopy Height Maps](https://sustainability.atmeta.com/blog/2024/04/22/using-artificial-intelligence-to-map-the-earths-forests/) | Worldwide | 1 m | Prediction from satellite imagery / 2009 and 2020 (80% are 2018-2020) |
|
|
381
|
+
| [ETH Global Sentinel-2 10m Canopy Height (2020)](https://langnico.github.io/globalcanopyheight/) | Worldwide | 10 m | Prediction from satellite imagery / 2020 |
|
|
382
|
+
|
|
383
|
+
### Land Cover
|
|
384
|
+
|
|
385
|
+
| Dataset | Spatial Coverage | Resolution | Source/Data Acquisition |
|
|
386
|
+
|---------|------------------|------------|----------------------|
|
|
387
|
+
| [ESA World Cover 10m 2021 V200](https://zenodo.org/records/7254221) | Worldwide | 10 m | Prediction from satellite imagery / 2021 |
|
|
388
|
+
| [ESRI 10m Annual Land Cover (2017-2023)](https://www.arcgis.com/home/item.html?id=cfcb7609de5f478eb7666240902d4d3d) | Worldwide | 10 m | Prediction from satellite imagery / 2017-2023 |
|
|
389
|
+
| [Dynamic World V1](https://dynamicworld.app) | Worldwide | 10 m | Prediction from satellite imagery / updated continuously |
|
|
390
|
+
| [OpenStreetMap](https://www.openstreetmap.org) | Worldwide | - (Vector) | Volunteered / updated continuously |
|
|
391
|
+
| [OpenEarthMap Japan](https://www.open-earth-map.org/demo/Japan/leaflet.html) | Japan | ~1 m | Prediction from aerial imagery / 1974-2022 (mostly after 2018 in major cities) |
|
|
392
|
+
| [UrbanWatch](https://urbanwatch.charlotte.edu/) | 22 major cities in the US | 1 m | Prediction from aerial imagery / 2014–2017 |
|
|
393
|
+
|
|
394
|
+
### Terrain Elevation
|
|
395
|
+
|
|
396
|
+
| Dataset | Coverage | Resolution | Source/Data Acquisition |
|
|
397
|
+
|---------|-----------|------------|------------------------|
|
|
398
|
+
| [FABDEM](https://doi.org/10.5523/bris.25wfy0f9ukoge2gs7a5mqpq2j7) | Worldwide | 30 m | Correction of Copernicus DEM using canopy height and building footprints data / 2011-2015 (Copernicus DEM) |
|
|
399
|
+
| [DeltaDTM](https://gee-community-catalog.org/projects/delta_dtm/) | Worldwide (Only for coastal areas below 10m + mean sea level) | 30 m | Copernicus DEM, spaceborne LiDAR / 2011-2015 (Copernicus DEM) |
|
|
400
|
+
| [USGS 3DEP 1m DEM](https://www.usgs.gov/3d-elevation-program) | United States | 1 m | Aerial LiDAR / 2004-2024 (mostly after 2015) |
|
|
401
|
+
| [England 1m Composite DTM](https://environment.data.gov.uk/dataset/13787b9a-26a4-4775-8523-806d13af58fc) | England | 1 m | Aerial LiDAR / 2000-2022 |
|
|
402
|
+
| [Australian 5M DEM](https://ecat.ga.gov.au/geonetwork/srv/eng/catalog.search#/metadata/89644) | Australia | 5 m | Aerial LiDAR / 2001-2015 |
|
|
403
|
+
| [RGE Alti](https://geoservices.ign.fr/rgealti) | France | 1 m | Aerial LiDAR |
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
## Citation
|
|
407
|
+
|
|
408
|
+
Please cite the [paper](https://doi.org) if you use `voxcity` in a scientific publication:
|
|
409
|
+
|
|
410
|
+
Fujiwara, K., XXX. XXX. XXX, XXX, XXX.
|
|
411
|
+
|
|
412
|
+
```bibtex
|
|
413
|
+
@article{,
|
|
414
|
+
author = {Fujiwara, Kunihiko and XXX, XXX and XXX, XXX and XXX, XXX},
|
|
415
|
+
doi = {XXX},
|
|
416
|
+
journal = {XXX},
|
|
417
|
+
pages = {XXX},
|
|
418
|
+
title = {XXX},
|
|
419
|
+
volume = {XXX},
|
|
420
|
+
year = {XXX}
|
|
421
|
+
}
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
## Credit
|
|
425
|
+
|
|
426
|
+
This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [`audreyr/cookiecutter-pypackage`](https://github.com/audreyr/cookiecutter-pypackage) project template.
|
|
427
|
+
|
|
428
|
+
--------------------------------------------------------------------------------
|
|
429
|
+
<br>
|
|
430
|
+
<br>
|
|
431
|
+
<p align="center">
|
|
432
|
+
<a href="https://ual.sg/">
|
|
433
|
+
<img src="https://raw.githubusercontent.com/winstonyym/urbanity/main/images/ualsg.jpeg" width = 55% alt="Logo">
|
|
434
|
+
</a>
|
|
435
|
+
</p>
|
|
436
|
+
|