Giter VIP home page Giter VIP logo

gdal2cesium's Introduction

gdal2cesium

Introduction

A Python command line utility, based on GDAL and inspired by gdal2tiles, to generate terrain heightmap tiles accordig to the native Cesium format

Any raster source supported by GDAL can be used. It can process multiple sources, with different size, resolution and covering area. The only requirement is that sources must have the same data type (Float32, Int16, etc.). You can transform the data type using gdal_translate. The original data will be merged according to the following rules:

  • Lower resolution sources are used to generate lower zoom levels tiles
  • When two sources with different resolution overlap, the lower one is used for lower zoom levels, the higher one is used for the highest zooms.
  • A tile for generated only if a source for the area covered by the tile exists and until source resolution is enough (less or equal) to the zoom level resolution.

This rules generate an optimal tiles coverage: tiles are generated only for those areas and zoom levels where a source meeting the required resolution is available. For each tile the data with the best resolution is choosen between the available sources.

Sources with different CRSs can be used but it's preferable and recommended to use data previously transformed to EPSG:4326 (WGS84). This will make the processing a lot faster.

NODATA values inside the raster sources must be set to 0. An example of pre processing is:

gdalwarp -s_srs epsg:3003 -t_srs epsg:4326 -srcnodata 9999 -dstnodata 0 source.tiff dest.tiff

gdalwarp will transform the source data to WGSS84 and set the destination NODATA value to 0.

Usage

Usage: gdal2cesium.py [options] input_file(s)

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -s S_SRS, --s_srs=S_SRS
                        Define input raster CRS (eg EPSG:3003)
  -z ZOOM, --zoom=ZOOM  Zoom levels to render (format:'2-5' or '10').
  -r RESAMPLING, --resampling=RESAMPLING
                        Resampling method
                        (average,near,bilinear,cubic,cubicspline,lanczos) -
                        default 'average'
  -e, --resume          Resume mode. Generate only missing files.
  -v, --verbose         Print status messages to stdout
  -o OUTPUT, --o_dir=OUTPUT
                        Root output directory
  -i, --index           Create the shapefile of tiles index (True or False)
  -k, --keep            Keep temporary files reated by gdal2cesium

Example usage with tiff sources already in EPSG:4326:

./gdal2cesium.py -o tiles *.tiff

The ouput tiles directory will be saved into the /tiles subfolder

gdal2cesium's People

Contributors

giohappy avatar

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.