BabylonJS widget
Project description
TileDB-PyBabylonJS
The TileDB-PyBabylonJS library is a geospatial data visualization Python library that interactively visualizes TileDB arrays with Babylon.js in a Jupyter notebook widget.
The package is under development and currently contains:
- point cloud visualizations with the option to stream all data from a TileDB array or define a bounding box to load a slice of the array
- MBRS visualization showing the minimum bounding rectangles of the fragments in the sparse array containing point cloud data
Installation
This project is available from PyPI and can be installed with pip
:
pip install pybabylonjs
If you are using Jupyter Notebook 5.2 or earlier, you may also need to enable the nbextension:
jupyter nbextension enable --py [--sys-prefix|--user|--system] pybabylonjs
Development Installation
Create and activate a development environment:
conda install -c conda-forge mamba
mamba create -n pybabylonjs-dev -c conda-forge nodejs yarn python=3.7.10 tree scipy 'pyarrow>2' numpy pandas tiledb-py rasterio gdal pdal python-pdal jupyter-packaging jupyterlab
conda activate pybabylonjs-dev
pip install opencv-python
Fork or clone the repo and go to the main directory. Install the TileDB-PyBabylonJS Python package that will also build the TypeScript package:
pip install -e ".[test, examples]"
When developing your extensions you need to manually enable your extensions with the notebook / lab frontend. For jupyter lab this is done by the command:
jupyter labextension install @jupyter-widgets/jupyterlab-manager
yarn run build
jupyter labextension install .
For a classic notebook you need to run:
jupyter nbextension install --sys-prefix --symlink --overwrite --py pybabylonjs
jupyter nbextension enable --sys-prefix --py pybabylonjs
Note that the --symlink
flag doesn't work on Windows, so you will here have to run
the install
command every time that you rebuild your extension. For certain installations
you might also need another flag instead of --sys-prefix
.
How to see your changes
TypeScript
The TypeScript code for the visualizations can be found in the TileDB-Viz repository. After making changes in TileDB-Viz build the package with:
yarn build
To then see these changes in TileDB-PyBabylonJS run:
yarn add file:/path/to/TileDB-Viz/packages/core
yarn build
And restart the notebook kernel.
Python
When you make a change to the Python code rebuild the package and restart the notebook kernel to see your changes.
Usage
Point clouds
Jupyter notebooks are provided in the examples folder for the following visualizations:
Display a point cloud visualization from a TileDB cloud sparse array by specifying the bounding box of a slice of the data:
from pybabylonjs import Show as show
bbox = {
'X': [636800, 637200],
'Y': [852800, 853100],
'Z': [406.14, 615.26]
}
lidar_array = "autzen-classified"
show.point_cloud(source="cloud",
uri = "tiledb://TileDB-Inc/autzen_classified_tiledb",
token = "***",
bbox = bbox,
particle_size = 2.5,
width = 1000,
height = 900,
rgb_max = 65535,
camera_radius = 700)
Or stream all data from a group of arrays:
show.point_cloud(streaming=True,
uri="***",
token="***",
max_levels=6,
particle_size = 3,
color_scheme = 'light',
width = '1200px',
height = '800px',
rgb_max = 255,
camera_radius = 800,
particle_budget = 8000000)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file pybabylonjs-1.2.0b1-py2.py3-none-any.whl
.
File metadata
- Download URL: pybabylonjs-1.2.0b1-py2.py3-none-any.whl
- Upload date:
- Size: 9.6 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0da0e06f6a5fe9ca540abcc429b912e02eff105e9ad63dd511c525a00564e403 |
|
MD5 | 671ea9392415900e734d924f095f2478 |
|
BLAKE2b-256 | 0b77f69350da383012437ce6f4d3619f5fc36237acc889ce2024f929199fbf6e |