Code Monkey home page Code Monkey logo

py3dtiles_batcher's Introduction

py3dtiles_merger

Disclaimer:

This project is under active development and has been created to generate data as fast as possible at Jakarto (rush time). It doesn't cover either unit test, well-written documentation, or a sufficient level of abstraction to be used in different contexts. However, I will be more than happy to remove this disclaimer when improvements will be done. Feel free to open an issue to help the project.

Convert .las files to 3dtiles in batch using py3dtiles.

You can then easily visualize your supersized .las files on the Internet thanks to 3d viewers like Cesium or Itowns.

Requirements

This project needs a docker image of py3dtiles. Please follow the instructions :

$ git clone https://github.com/Tofull/py3dtiles
$ cd py3dtiles
$ git checkout feature/Docker_support
$ docker build -t py3dtiles .

Installation

  • Local installation (recommanded until the project support pypi integration)

    $ git clone https://github.com/Tofull/py3dtiles_batcher
    $ cd py3dtiles_batcher
    $ pip install .

Usage

usage: py3dtiles_batcher [-h] [--dryrun] [--incremental] [--srs_in SRS_IN]
                 [--srs_out SRS_OUT] [--cache_size CACHE_SIZE]
                 [--docker_image DOCKER_IMAGE] [--verbose] [--norgb]
                 output_folder [input_folder [input_folder ...]]

Convert .las file to 3dtiles in batch.

positional arguments:
output_folder         Directory to save tiles.
input_folder          Directory to watch. (default: .)

optional arguments:
    -h, --help            show this help message and exit
    --dryrun              Active dryrun mode. No tile will be generated in this
                            mode. (default: False)
    --incremental         Active incremental mode. Skip tile if
                            <output_folder>/<tile>/tileset.json exists. (default:
                            False)
    --srs_in SRS_IN       Srs in. (default: 2959)
    --srs_out SRS_OUT     Srs out. (default: 4978)
    --cache_size CACHE_SIZE
                            Cache size in MB. (default: 3135)
    --docker_image DOCKER_IMAGE
                            py3dtiles docker image to use. (default: py3dtiles)
    --verbose, -v         Verbosity (-v simple info, -vv more info, -vvv spawn
                            info) (default: 0)
    --norgb               Do not export rgb attributes (default: True)

Working example (remove --dryrun when you want to generate tiles) :
py3dtiles_batcher.exe "D:\data_py3dtiles\output" "D:\data_py3dtiles\raw" --dryrun -v

Examples

If you want to convert all .las from "D:data_py3dtilesraw" directory and save result into "D:data_py3dtilesoutput":

# On windows
py3dtiles_batcher.exe -v "D:\data_py3dtiles\output" "D:\data_py3dtiles\raw"

You can select specific files or folder you want to convert:

# On windows
py3dtiles_batcher.exe -v "D:\data_py3dtiles\output" "D:\data_py3dtiles\raw" "D:\folder1\file1.las" "D:\folder2"

Notes :

  • Remember to specify the srs_in option if its differs from EPSG:2959
  • output path will be written in base64 encodage, to respect URL’s standard (which will be useful for 3d webviewer [Read What's next section]). Don't be surprised.

What's next ?

  • Visualize 3dtiles individually

    Once yours .las files have been converted into 3dtiles, you can expose them individually over the Internet with any http server, like :

    # using https://www.npmjs.com/package/http-server
    npm install http-server -g
    http-server D:\data_py3dtiles\output --cors -p 8080

    Then, each tileset in subfolder is available over the Internet, and you can visualize it one by one using a 3d viewer, for example Cesium sandcastle :

    1. Go to https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/index.html
    2. Insert the following code on Javascript Code section. Replace <base64_name> by the name of the directory of the tileset.json you want to visualize.

      var viewer = new Cesium.Viewer('cesiumContainer');
      var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
          url : 'http://127.0.0.1:8080/<base64_name>/tileset.json'
      }));
    3. Click Run (or F8) and enjoy.

      Example on cesium

  • Visualize merged 3dtiles

    If you want to visualize all your 3dtiles at the same time, some steps are required to merge them into one big tileset.json. Hopefully, I created the merger tool. Please refer to it by clicking on the following link : https://github.com/Tofull/py3dtiles_merger

    After some discussion with Oslandia' developers team, they have released a new version of py3dtiles with a "merge" command which is intended to do a better stuff than py3dtiles_merger. The previous command "py3dtiles" (renamed as "py3dtiles convert") - used to generate the individual 3dtiles - needed some changes (a well-done hierarchical 3d points structure from children, reconsidering a true computation of the geometricError attribute).

Contribution

Contributions are welcome. Feel free to open an issue for a question, a remark, a typo, a bugfix or a wanted feature.

Licence

Copyright © 2018 Loïc Messal (@Tofull) and contributors

Distributed under the MIT Licence.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.