p3dtilers is a Python tool and library allowing to build 3D Tiles
tilesets out of various geometrical formats e.g. OBJ, GeoJSON, IFC or CityGML through 3dCityDB databases
p3dtilers uses py3dtiles
python library for its in memory representation of tilesets
CLI Features
- ObjTiler: converts OBJ files to a 3D Tiles tileset
- GeojsonTiler: converts GeoJson files to a 3D Tiles tileset
- IfcTiler: converts IFC files to a 3D Tiles tileset
- CityTiler: converts CityGML features (e.g buildings, water bodies, terrain...) extracted from a 3dCityDB database to a 3D Tiles tileset
In order to install py3dtilers from sources use:
$ apt install git python3 python3-pip virtualenv
$ git clone https://github.com/VCityTeam/py3dtilers
$ cd py3dtilers
Install binary sub-dependencies with your platform package installer e.g. for Ubuntu use
$ apt-get install -y liblas-c3 libopenblas-base # py3dtiles binary dependencies
$ apt-get install -y libpq-dev # required usage of psycopg2 within py3dtilers
(Warning: when using Ubuntu 20.04, replace liblas-c3
by liblaszip-dev
)
Proceed with the installation of py3dtilers
per se
$ virtualenv -p python3 venv
$ . venv/bin/activate
(venv)$ pip install -e .
Caveat emptor: make sure, that the IfcOpenShell dependency was properly installed with help of the python -c 'import ifcopenshell'
command. In case
of failure of the importation try re-installing but this time with the verbose
flag, that is try
(venv)$ pip install -e . -v
and look for the lines concerning IfcOpenShell.
To use the a tiler, check the corresponding readme to know the usage and the features of the tiler.
After the installation, if you additionally wish to run unit tests, use
(venv)$ pip install -e .[dev]
(venv)$ pytest
To run CityTiler's tests, you need to install PostgreSQL and Postgis.
To setup PostgreSQL with Postgis on Windows or Ubuntu, follow the PostgreSQL tutorial.
Once the setup is over, update the config files (e.g test_config.yml, test_config_2009.yml and test_config_2012.yml) with the right password. Ignore the config files to avoid commiting them in the repo
git update-index --assume-unchanged tests/*/test_config*
Then, in a shell, run:
> psql -c 'create database test_city_tiler;' -U postgres
> psql -U postgres -d test_city_tiler -f tests/city_tiler_test_data/test_data.sql
> psql -c 'create database test_temporal_2009;' -U postgres
> psql -U postgres -d test_temporal_2009 -f tests/city_temporal_tiler_test_data/test_data_temporal_2009.sql
> psql -c 'create database test_temporal_2012;' -U postgres
> psql -U postgres -d test_temporal_2012 -f tests/city_temporal_tiler_test_data/test_data_temporal_2012.sql
First, install the additional dev requirements
(venv)$ pip install -e .[dev]
To check if the code follows the coding style, run flake8
(venv)$ flake8 .
You can fix most of the coding style errors with autopep8
(venv)$ autopep8 --in-place --recursive py3dtilers/
If you want to apply autopep8
from root directory, exclude the venv directory
(venv)$ autopep8 --in-place --exclude='venv*' --recursive .
By default, the py3dtilers' setup.py
build stage uses github's version of py3dtiles (as opposed to using Oslandia's version on Pypi.
When developing one might need/wish to use a local version of py3dtiles (located on host in another directory e.g. by cloning the original repository) it is possible
- to first install py3dtiles by following the installation notes
- then within the py3dtilers (cloned) directory, comment out (or delete) the line reference to py3dtiles.
This boils down to :
$ git clone https://github.com/VCityTeam/py3dtiles
$ cd py3dtiles
$ ...
$ source venv/bin/activate
(venv)$ cd ..
(venv)$ git clone https://github.com/VCityTeam/py3dtilers
(venv)$ cd py3dtilers
(venv)$ # Edit setup.py and comment out py3dtiles reference
(venv)$ pip install -e .
(venv)$ pytest
- For developers, some design notes
- Credentials: CityTiler original code is due to Jeremy Gaillard (when working at LIRIS, University of Lyon, France)