Package: pybabylonjs
TileDB-PyBabylonJSThe TileDB-PyBabylonJS library is a geospatial data visualization Python library that interactively visualizes TileDB arrays withBabylon.jsin 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 arrayInstallationThis project is available fromPyPIand can be installed withpip:pipinstallpybabylonjsIf you are using Jupyter Notebook 5.2 or earlier, you may also need to enable the nbextension:jupyternbextensionenable--py[--sys-prefix|--user|--system]pybabylonjsDevelopment InstallationCreate and activate a development environment:condacreate-npybabylonjs-dev-cconda-forgenodejsyarnpythontreescipy'pyarrow>2'numpypandastiledb-pyjupyter-packagingjupyterlab

condaactivatepybabylonjs-dev

pipinstallopencv-pythonFork or clone the repo and go to the main directory. Install the TileDB-PyBabylonJS Python package that will also build the TypeScript package:pipinstall-e".[test, examples]"When developing extensions you need to manually enable the extensions with the notebook / lab frontend. For jupyter lab this is done by the command:jupyterlabextensioninstall@jupyter-widgets/jupyterlab-manager
yarnrunbuild
jupyterlabextensiondevelop.--overwriteFor a classic notebook you need to run:jupyternbextensioninstall--sys-prefix--symlink--overwrite--pypybabylonjs
jupyternbextensionenable--sys-prefix--pypybabylonjsNote that the--symlinkflag doesn't work on Windows, so you will here have to run
theinstallcommand every time that you rebuild your extension. For certain installations
you might also need another flag instead of--sys-prefix.How to see your changesTypeScriptThe TypeScript code for the visualizations can be found in theTileDB-Vizrepository. After making changes in TileDB-Viz build the package with:yarn buildTo then see these changes in TileDB-PyBabylonJS run:yarn add file:/path/to/TileDB-Viz/packages/coreyarn buildAnd restart the notebook kernel.PythonWhen you make a change to the Python code rebuild the package and restart the notebook kernel to see your changes.UsageJupyter notebooks are provided in theexamples folderfor the following visualizations:Point cloud visualization parameterscontains a description of all parametersSlice of the Autzen point cloudSlice of the Boulder point cloudStreaming the Autzen point cloudStreaming the Bristol point cloudStreaming the Santorini point cloudSign up for a TileDB accountand display a point cloud visualization from a TileDB cloud sparse array by specifying the bounding box of a slice of data:frompybabylonjsimportShowasshowbbox={'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=token,bbox=bbox,point_size=3,rgb_max=65535,camera_up=25,camera_location=2,camera_zoom=[2,2,2],point_type='fixed_screen_size',width=1000,height=600)Or stream all data from a group of arrays:show.point_cloud(streaming=True,uri="tiledb://TileDB-Inc/bristol",token=token,point_size=4,wheel_precision=0.2,color_scheme='dark',width=1200,height=800,rgb_max=255,point_budget=3500000,camera_location=8,camera_zoom=[1,1,2],camera_up=50,move_speed=8,point_type='fixed_world_size')ParametersThe following parameters can be set for a point cloud visualization:camera_locationis the location of the arcRotateCamera in relation to the centre of the point cloud. 1: south, 2: south-east, 3: east, 4: north-east, 5: north, 6: north-west, 7: west, 8: south-west and 9: looking down from above the centre of the point cloudcamera_upis the height of the initial location of the freeCameracamera_zoomscales the camera position relative to the centre of the point cloud with[1,1,1]being in the default position and[2,2,2]is then twice a far away from the centre in the X, Y and Z directioncolor_schemeis the initial background color:dark(default),lightorbluedatais the dictionary with the point cloud data whensource = dict. This dictionary needs to contain values for the locationX,YandZand the RGB color for each pointRed,GreenandBlueheightis the height of the display window in pixelspoint_sizeis the size of the pointspoint_typeis the interactive point size typefixed_screen_size(default): each point has a constant size in pixels regardless of its distance to the camerafixed_world_space: each point has a constant size in world space. This value should be set accordingly to the spacing of the points in world spaceadaptive_world_space: the same asfixed_world_spacefor the below example. But when streaming point cloud data, the point size depends on the locally loaded LODs at each point. The point density across all blocks of the same LOD should be the same and the point density should double at each LODsourceis the data source (cloud(default),localordict)use_sps=Truedisplays the points as 3D blocks using aSolid Particle Systemuse_shader=Trueadds the EDL shadingedl_strengthis the strenght of the shaderwheel_precisiongives control over how fast to zoom with the mouse wheelwidthis the width of the display window in pixelsNavigating the point cloudThere are two different cameras available to navigate the point cloud, the arcRotateCamera and freeCamera. Toggle between them withc. The initial camera is always the arcRotateCameraarcRotateCameraZoom in and out with the scroll wheelRotate by dragging the mouse with left button downThe parameterwheel_precisiongives control over how fast to zoom with the mouse wheelThe camera location and distance from the centre of the points can be changed withcamera_locationandcamera_zoomRotate through thecamera_locationswithvChange the background color between dark and light withbfreeCameraMove forward:worupMove backward:sordownMove up:eMove down:qMove to the left:aorleftMove to the right:dorrightRotate by dragging the mouse with left button downThe initial camera position is the centre of the point cloud, the height of the location can be changed with the parametercamera_upThe camera speed can be changed with the parametermove_speedChange the background color between dark and light withb