Skip to main content

Python module for 3D tiles format

Project description

chat link Build pipeline status Py3dtiles version on pypi Supported python versions Code coverage py3dtiles GitLab last commit Py3dtiles license

Py3dtiles

Py3dtiles is a CLI tool and a library writing with Python for creating and manipulating 3D Tiles.

Features

Tileset manipulation

  • Read tileset lazily (to avoid useless memory consumption)

  • Write tilesets with their tile contents

  • Browse the tile structure, access to the properties and tile content with the ability to modify them

  • Read and write pnts and b3dm with the batch table support

Tiling tools

All tiling tools are available with the API and the CLI

  • Convert data into 3d tiles (tileset.json + pnts/b3dm files). The supported file formats are:
    • las/laz

    • xyz

    • ply

    • wkb

  • Merge 3D Tiles tilesets into one tileset

  • Read pnts and b3dm files and print a summary of their contents

Installation

With pip

To install Py3dtiles with pip (recommended method)

pip install py3dtiles

For installing specific format dependencies (las/laz, ply, postgis, install from source…), please read the installation section in the documentation.

With docker

docker run -it --rm \
    --mount type=bind,source="$(pwd)",target=/data/ \
    --volume /etc/passwd:/etc/passwd:ro \
    --volume /etc/group:/etc/group:ro \
    --user $(id -u):$(id -g) \
    py3dtiles/py3dtiles:<version> \
    convert <file>

The 3dtiles/ directory should appear in your current directory.

NOTE:

  • the –mount option is necessary for docker to read your source data and to write the result. The way it is written in this example only allows you to read source files in the current folder or in a subfolder

  • This line –volume /etc/passwd:/etc/passwd:ro –volume /etc/group:/etc/group:ro –user $(id -u):$(id -g) is only necessary if your uid is different from 1000.

API basic example

>>> from pathlib import Path
>>>
>>> from py3dtiles.tileset.tileset import TileSet
>>>
>>> tileset = TileSet.from_file(Path("tests/fixtures/tiles/tileset.json"))
>>> all_tiles = (tileset.root_tile, *tileset.root_tile.get_all_children())
>>> for tile in all_tiles:
...     if not tile.has_content():
...         continue
...     tile_content = tile.get_or_fetch_content(tileset.root_uri)
...     print(f"The tile {tile.content_uri} has a content of {type(tile_content)} type")
...     print(f"with this bounding volume: {tile.bounding_volume.to_dict()}")
The tile r.pnts has a content of <class 'py3dtiles.tileset.content.pnts.Pnts'> type
with this bounding volume: {'box': [np.float64(0.390625), np.float64(0.3125), np.float64(0.0), np.float64(0.390625), np.float64(0.0), np.float64(0.0), np.float64(0.0), np.float64(0.3125), np.float64(0.0), np.float64(0.0), np.float64(0.0), np.float64(0.0)]}
The tile r1.pnts has a...

Result example

The data visualized on this website is generated with the convert and merge CLI command of Py3dtiles: https://giro3d.org/examples/lidar_hd.html

The library used on this site is giro3d but there are other 3dtiles viewers.

Lidar HD data converted into 3d tiles visualized with giro3d

Documentation

The CLI and API documentation with examples are available here:

Roadmap

The objectives are:

  • to support the standard at version 1.1 (mainly gltf as content)

  • to convert more file formats

  • to have a better tiler for geometries

Contributing

We welcome new contributions. This may be fixing an issue or adding a feature, but also:

  • reporting an issue

  • reviewing a MR

  • improving the documentation or creating a tutorial

  • talking about this project to others

  • help others on the [chat room](https://matrix.to/#/#py3dtiles:matrix.org)

We have written a contributing guide to help you for your first contribution.

License

Py3dtiles is distributed under the Apache 2 Licence.

Thanks

The following entities have funded py3dtiles:

Project details


Download files

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

Source Distribution

py3dtiles-12.1.1.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py3dtiles-12.1.1-py3-none-any.whl (123.6 kB view details)

Uploaded Python 3

File details

Details for the file py3dtiles-12.1.1.tar.gz.

File metadata

  • Download URL: py3dtiles-12.1.1.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for py3dtiles-12.1.1.tar.gz
Algorithm Hash digest
SHA256 b750a3724ad88c74a8fc6f3a7f465d67581db9006f3c7dcbbc77e9281bb57b40
MD5 75e2881ed266cef406de5b3bcc0e3af6
BLAKE2b-256 6c901430cb7ab17b6ea33c11c0b31cb27c0eace90dfd759a3dc135dfea6316c4

See more details on using hashes here.

File details

Details for the file py3dtiles-12.1.1-py3-none-any.whl.

File metadata

  • Download URL: py3dtiles-12.1.1-py3-none-any.whl
  • Upload date:
  • Size: 123.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for py3dtiles-12.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba6b0e1b573ea2a45bbaf826804d7d46d30cb21dcceb416e428b464addc16f2f
MD5 890e5eb943126c9c4d9c70dc7712f725
BLAKE2b-256 5d5628d24bf069ca8600ac106977665d1c8931a346b45ac5276a082f657a688d

See more details on using hashes here.

Supported by

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