Skip to main content

BabylonJS widget

Project description

TileDB-PyBabylonJS

codecov Build Status

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pybabylonjs-1.2.2b1-py2.py3-none-any.whl (8.3 MB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page