{ "info": { "author": "dev", "author_email": "contact@oslandia.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5" ], "description": ".. image:: https://secure.travis-ci.org/Oslandia/py3dtiles.png\n\n.. image:: https://badge.fury.io/py/py3dtiles.svg\n :target: https://badge.fury.io/py/py3dtiles\n\n=========\npy3dtiles\n=========\n\nPython module to manage 3DTiles format.\n\nFor now, only the Point Cloud and the Batched 3D Model specifications are supported.\n\npy3dtiles is distributed under LGPL2 or later.\n\n\nInstall\n-------\n\nFrom sources\n~~~~~~~~~~~~\n\nTo use py3dtiles from sources:\n\n.. code-block:: shell\n\n $ git clone https://github.com/Oslandia/py3dtiles\n $ cd py3dtiles\n $ virtualenv -p /usr/bin/python3 venv\n $ . venv/bin/activate\n (venv)$ pip install -e .\n (venv)$ python setup.py install\n\nIf you wan to run unit tests:\n\n.. code-block:: shell\n\n (venv)$ pip install nose\n (venv)$ nosetests\n ...\n\nSpecifications\n--------------\n\nGeneric Tile\n~~~~~~~~~~~~\n\nThe py3dtiles module provides some classes to fit into the\nspecification:\n\n- *Tile* with a header *TileHeader* and a body *TileBody*\n- *TileHeader* represents the metadata of the tile (magic value, version, ...)\n- *TileBody* contains varying semantic and geometric data depending on the the tile's type\n\nMoreover, a utility class *TileReader* is available to read a tile\nfile as well as a simple command line tool to retrieve basic information\nabout a tile: **py3dtiles\\_info**. We also provide a utility to generate a\ntileset from a list of 3D models in WKB format or stored in a postGIS table.\n\n**How to use py3dtiles\\_info**\n\nHere is an example on how to retrieve basic information about a tile, in this\ncase *pointCloudRGB.pnts*:\n\n.. code-block:: shell\n\n $ py3dtiles_info tests/pointCloudRGB.pnts\n Tile Header\n -----------\n Magic Value: pnts\n Version: 1\n Tile byte length: 15176\n Feature table json byte length: 148\n Feature table bin byte length: 15000\n\n Feature Table Header\n --------------------\n {'POSITION': {'byteOffset': 0}, 'RGB': {'byteOffset': 12000}, 'POINTS_LENGTH': 1000, 'RTC_CENTER': [1215012.8828876738, -4736313.051199594, 4081605.22126042]}\n\n First point\n -----------\n {'Z': -0.17107764, 'Red': 44, 'X': 2.19396, 'Y': 4.4896851, 'Green': 243, 'Blue': 209}\n\n\n**How to use export\\_tileset**\n\nTwo export modes are available, the database export or the directory export.\nThey both transform all the geometries provided in .b3dm files, along with a\ntileset.json file which organizes them.\n\nThe directory export will use all the .wkb files in the provided directory.\nWarning: the coordinates are read as floats, not doubles. Make sure to offset\nthe coordinates beforehand to reduce their size. Afterwards, you can indicate\nin the command line the offset that needs to be applied to the tileset so it is\ncorrectly placed. Usage example:\n\n.. code-block:: shell\n\n $ export_tileset -d my_directory -o 10000 10000 0\n\n\nThe database export requires a user name, a database name, the name of the table\nand its column that contains the geometry and (optionaly) the name of the column\nthat contains the object's ID. Usage example:\n\n.. code-block:: shell\n\n $ export_tileset -D database -t my_city -c geom -i id -u oslandia\n\n\nPoint Cloud\n~~~~~~~~~~~\n\nPoints Tile Format:\nhttps://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/TileFormats/PointCloud\n\nIn the current implementation, the *Pnts* class only contains a *FeatureTable*\n(*FeatureTableHeader* and a *FeatureTableBody*, which contains features of type\n*Feature*).\n\n**How to read a .pnts file**\n\n.. code-block:: python\n\n >>> from py3dtiles import TileReader\n >>> from py3dtiles import Pnts\n >>>\n >>> filename = 'tests/pointCloudRGB.pnts'\n >>>\n >>> # read the file\n >>> tile = TileReader().read_file(filename)\n >>>\n >>> # tile is an instance of the Tile class\n >>> tile\n \n >>>\n >>> # extract information about the tile header\n >>> th = tile.header\n >>> th\n \n >>> th.magic_value\n 'pnts'\n >>> th.tile_byte_length\n 15176\n >>>\n >>> # extract the feature table\n >>> ft = tile.body.feature_table\n >>> ft\n >>\n >>> # display feature table header\n >>> ft.header.to_json()\n {'RTC_CENTER': [1215012.8828876738, -4736313.051199594, 4081605.22126042],\n 'RGB': {'byteOffset': 12000}, 'POINTS_LENGTH': 1000, 'POSITION': {'byteOffset': 0}}\n >>>\n >>> # extract positions and colors of the first point\n >>> f = ft.feature(0)\n >>> f\n \n >>> f.positions\n {'Y': 4.4896851, 'X': 2.19396, 'Z': -0.17107764}\n >>> f.colors\n {'Green': 243, 'Red': 44, 'Blue': 209}\n\n**How to write a .pnts file**\n\nTo write a Point Cloud file, you have to build a numpy array with the\ncorresponding data type.\n\n.. code-block:: python\n\n >>> from py3dtiles import Feature\n >>> import numpy as np\n >>>\n >>> # create the numpy dtype for positions with 32-bit floating point numbers\n >>> dt = np.dtype([('X', '>>\n >>> # create a position array\n >>> position = np.array([(4.489, 2.19, -0.17)], dtype=dt)\n >>>\n >>> # create a new feature from a uint8 numpy array\n >>> f = Feature.from_array(dt, position.view('uint8'))\n >>> f\n \n >>> f.positions\n {'Y': 2.19, 'X': 4.489, 'Z': -0.17}\n >>>\n >>> # create a tile directly from our feature. None is for \"no colors\".\n >>> t = Pnts.from_features(dt, None, [f])\n >>>\n >>> # the tile is complete\n >>> t.body.feature_table.header.to_json()\n {'POINTS_LENGTH': 1, 'POSITION': {'byteOffset': 0}}\n >>>\n >>> # to save our tile as a .pnts file\n >>> t.save_as(\"mypoints.pnts\")\n\n\nBatched 3D Model\n~~~~~~~~~~~~~~~~\n\nBatched 3D Model Tile Format:\nhttps://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/TileFormats/Batched3DModel\n\n**How to read a .b3dm file**\n\n.. code-block:: python\n\n >>> from py3dtiles import TileReader\n >>> from py3dtiles import B3dm\n >>>\n >>> filename = 'tests/dragon_low.b3dm'\n >>>\n >>> # read the file\n >>> tile = TileReader().read_file(filename)\n >>>\n >>> # tile is an instance of the Tile class\n >>> tile\n \n >>>\n >>> # extract information about the tile header\n >>> th = tile.header\n >>> th\n \n >>> th.magic_value\n 'b3dm'\n >>> th.tile_byte_length\n 47246\n >>>\n >>> # extract the glTF\n >>> gltf = tile.body.glTF\n >>> gltf\n \n >>>\n >>> # display gltf header's asset field\n >>> gltf.header['asset']\n {'premultipliedAlpha': True, 'profile': {'version': '1.0', 'api': 'WebGL'}, 'version': '1.0', 'generator': 'OBJ2GLTF'}\n\n**How to write a .b3dm file**\n\nTo write a Batched 3D Model file, you have to import the geometry from a wkb\nfile containing polyhedralsurfaces or multipolygons.\n\n.. code-block:: python\n\n >>> import numpy as np\n >>> from py3dtiles import GlTF, TriangleSoup\n >>>\n >>> # load a wkb file\n >>> wkb = open('tests/building.wkb', 'rb').read()\n >>>\n >>> # define the geometry's bouding box\n >>> box = [[-8.75, -7.36, -2.05], [8.80, 7.30, 2.05]]\n >>>\n >>> # define the geometry's world transformation\n >>> transform = np.array([\n ... [1, 0, 0, 1842015.125],\n ... [0, 1, 0, 5177109.25],\n ... [0, 0, 1, 247.87364196777344],\n ... [0, 0, 0, 1]], dtype=float)\n >>> transform = transform.flatten('F')\n >>>\n >>> # use the TriangleSoup helper class to transform the wkb into arrays\n >>> # of points and normals\n >>> ts = TriangleSoup.from_wkb_multipolygon(wkb)\n >>> positions = ts.getPositionArray()\n >>> normals = ts.getNormalArray()\n >>> # generate the glTF part from the binary arrays.\n >>> # notice that from_binary_arrays accepts array of geometries\n >>> # for batching purposes.\n >>> geometry = { 'position': positions, 'normal': normals, 'bbox': box }\n >>> gltf = GlTF.from_binary_arrays([geometry], transform)\n >>>\n >>> # create a b3dm tile directly from the glTF.\n >>> t = B3dm.from_glTF(glTF)\n >>>\n >>> # to save our tile as a .b3dm file\n >>> t.save_as(\"mymodel.b3dm\")\n\nThird party assets\n------------------\n\nDragon model from Analytical Graphics Inc.'s `3d-tiles samples`_\n\n.. _3d-tiles samples: https://github.com/AnalyticalGraphicsInc/3d-tiles-samples\n\n`Earcut-python`_ by Joshua Skelton\n\n.. _Earcut-python: https://github.com/joshuaskelly/earcut-python\n\nISC License\n\nCopyright (c) 2016, Mapbox\n\nPermission to use, copy, modify, and/or distribute this software for any purpose\nwith or without fee is hereby granted, provided that the above copyright notice\nand this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\nFITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS\nOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER\nTORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF\nTHIS SOFTWARE.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Oslandia/py3dtiles", "keywords": "", "license": "LGPL2 or later", "maintainer": "", "maintainer_email": "", "name": "py3dtiles", "package_url": "https://pypi.org/project/py3dtiles/", "platform": "", "project_url": "https://pypi.org/project/py3dtiles/", "project_urls": { "Homepage": "https://github.com/Oslandia/py3dtiles" }, "release_url": "https://pypi.org/project/py3dtiles/1.0.2/", "requires_dist": [ "numpy", "pyproj", "cython", "triangle", "psycopg2-binary", "pytest; extra == 'dev'", "pytest-cov; extra == 'dev'", "sphinx; extra == 'doc'", "sphinx-rtd-theme; extra == 'doc'" ], "requires_python": "", "summary": "Python module for 3D tiles format", "version": "1.0.2" }, "last_serial": 3830140, "releases": { "0.0.9": [ { "comment_text": "", "digests": { "md5": "8faab7d4eb0cc7701caafa17578b331b", "sha256": "bd013f13c50d04bf8e1a4318dd0eb19e3b5e304e11553cceef144e82cd8ece55" }, "downloads": -1, "filename": "py3dtiles-0.0.9.tar.gz", "has_sig": false, "md5_digest": "8faab7d4eb0cc7701caafa17578b331b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17620, "upload_time": "2016-11-03T11:07:46", "url": "https://files.pythonhosted.org/packages/88/9d/17e76e344d1c16fa0543643f21716dfdc2f96fd51d24c21d3e24e28b0836/py3dtiles-0.0.9.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "bc95c4f0b7771ac6e53b668fbbc32418", "sha256": "9121609009ef8aede453f76fb870d03ad4645c6498ffe18c0d0f0b72d74c2999" }, "downloads": -1, "filename": "py3dtiles-1.0.1.tar.gz", "has_sig": false, "md5_digest": "bc95c4f0b7771ac6e53b668fbbc32418", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 37540, "upload_time": "2018-02-27T17:34:39", "url": "https://files.pythonhosted.org/packages/33/64/0a62ee5a5a03ca10042892739d7f6688fc5fd06aa3a8401fda169f1c4316/py3dtiles-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "8043eb96ac74d2ee70f521e385753259", "sha256": "72d03fc726f4c1d670e4b5055fb8cdadc55767625f75590ed1485f7227792a41" }, "downloads": -1, "filename": "py3dtiles-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "8043eb96ac74d2ee70f521e385753259", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 29198, "upload_time": "2018-05-03T09:16:12", "url": "https://files.pythonhosted.org/packages/f0/ff/831472a4908823b0d8ab737c666c973de2e1bc8e454126e24878c0e2cf96/py3dtiles-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f9022788413d22f7cf7984d168745092", "sha256": "f81dcff5808dedd525923f5eea0c14b00c9ac1faa9eadc7cb4e03b99ec3f54dd" }, "downloads": -1, "filename": "py3dtiles-1.0.2.tar.gz", "has_sig": false, "md5_digest": "f9022788413d22f7cf7984d168745092", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 39309, "upload_time": "2018-05-03T09:16:14", "url": "https://files.pythonhosted.org/packages/a6/89/2fe235de11eb17b10400db71e6bf4ee68bc73e24b9fa0f07b985ef9dab34/py3dtiles-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8043eb96ac74d2ee70f521e385753259", "sha256": "72d03fc726f4c1d670e4b5055fb8cdadc55767625f75590ed1485f7227792a41" }, "downloads": -1, "filename": "py3dtiles-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "8043eb96ac74d2ee70f521e385753259", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 29198, "upload_time": "2018-05-03T09:16:12", "url": "https://files.pythonhosted.org/packages/f0/ff/831472a4908823b0d8ab737c666c973de2e1bc8e454126e24878c0e2cf96/py3dtiles-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f9022788413d22f7cf7984d168745092", "sha256": "f81dcff5808dedd525923f5eea0c14b00c9ac1faa9eadc7cb4e03b99ec3f54dd" }, "downloads": -1, "filename": "py3dtiles-1.0.2.tar.gz", "has_sig": false, "md5_digest": "f9022788413d22f7cf7984d168745092", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 39309, "upload_time": "2018-05-03T09:16:14", "url": "https://files.pythonhosted.org/packages/a6/89/2fe235de11eb17b10400db71e6bf4ee68bc73e24b9fa0f07b985ef9dab34/py3dtiles-1.0.2.tar.gz" } ] }