A command-line tool for converting heightmaps in GeoTIFF format into tiled optimized meshes.

Overview

TIN Terrain

Build Status

TIN Terrain is a command-line tool for converting heightmaps presented in GeoTIFF format into tiled optimized meshes (Triangulated Irregular Network) with different levels of details.

Check out heremaps/quantized-mesh-viewer for examples of rendering output in Cesium.js and Three.js.

Note: This is experimental code, expect changes.

dem2tin GeoTIFF to mesh on USGS craterlake DEM

Features

  • Takes GeoTIFF with heightmap as an input
  • Transforms heightmap into a TIN mesh with a given max-error parameter and outputs into .obj format
  • Transforms heightmap into tiled TIN mesh for a given zoom range and outputs tiled pyramid into quantized-mesh-1.0 terrain format

Let us know what you think!

You can help us a lot to prioritize issues in tin-terrain if you submit a short anonymous survey

Installation

You can build and run this tool either with Docker or directly on your system. Building with Docker is easier and works on macOS, Linux, and Windows.

Detailed instructions for each platform are provided below.

Building with Docker

The provided Dockerfile builds the TIN Terrain executable on Ubuntu Linux.

To build the container, execute:

./build-docker.sh

To run TIN Terrain from Docker, type e.g.

docker run -v [local data directory]:/data:cached --name tin-terrain --rm -i -t tin-terrain tin-terrain ...

where [local data directory] is the folder that contains your DEM files and will receive the output files. This will be mapped to /data in the Docker instance, so you should use:

docker run -v [local data directory]:/data:cached --name tin-terrain --rm -i -t tin-terrain tin-terrain dem2tin --input /data/... --output /data/... 

Alternatively, use

docker run -v [local data directory]:/data:cached --name tin-terrain --rm -i -t tin-terrain bash 

to open an interactive shell which lets you execute tin-terrain and access /data. Any files not stored in /data will be lost when closing the session.

Prerequisites & Dependencies

If you choose to compile and run "TIN Terrain" directly on your system, please note that the following packages must be installed on your system:

  • The C++ standard library from the compiler (tested with clang 9.1.0 and gcc 7.3.0)
  • Boost (BSL-1.0) program_options, filesystem, system (tested with version 1.67)
  • GDAL (MIT) gdal, gdal_priv, cpl_conv (tested with version 2.3)

TIN Terrain also downloads some source code of 3rd party libraries during the CMake configure phase:

You can disable this behaviour by passing the -DTNTN_DOWNLOAD_DEPS=OFF option to CMake when generating the project/makefiles. If you do so, you have to download dependencies yourself and also pass the TNTN_LIBGLM_SOURCE_DIR and TNTN_LIBFMT_SOURCE_DIR variables to CMake as well as TNTN_CATCH2_SOURCE_DIR if you want to run the tests.

See download-deps.cmake for detailed version info.

Building on macOS

  1. Install dependencies, preferably with homebrew:
    brew install boost
    brew install cmake
    brew install gdal
    
  2. Create an XCode project:
    mkdir build-cmake-xcode
    cd build-cmake-xcode
    cmake -GXcode path/to/sourcecode/
    open tin-terrain.xcodeproj
    
  3. Build the TIN Terrain target.

The resulting binaries will be in the Debug/Release subdirectory.

To run the tests, build and run the tntn-tests target.

Possible linking issues with GDAL

If another version of GDAL is present on your machine, the FindGDAL.cmake provided with cmake might not be able to properly detect the newest version of GDAL you installed through homebrew (or any other prefered method).

Whether this is the case, can be easily detected, if the linking step in the compilation errors on linking GDAL.

Therefore you might need to guide cmake to the right location of the GDAL:

cmake -GXcode -DGDAL_LIBRARY=PATH/TO/GDAL/LIB path/to/sourcecode/

e.g

cmake -GXcode -DGDAL_LIBRARY=/usr/local/Cellar/gdal/2.3.1_2/lib/libgdal.dylib path/to/sourcecode/

Building on Linux

  1. Install dependencies, e.g. on Ubuntu:
    apt-get install build-essential cmake libboost-all-dev libgdal-dev
    
  2. Create Makefile:
    mkdir build-cmake-release
    cd build-cmake-release
    cmake -DCMAKE_BUILD_TYPE=Release path/to/sourcecode/
    
  3. Build the tin-terrain target
    VERBOSE=1 make tin-terrain
    

The resulting binary should then be ready. To run the tests, build and run the tntn-tests target:

  1. Recreate Makefile (and set TNTN_TEST=ON):
    cd build-cmake-release
    cmake -DTNTN_TEST=ON -DCMAKE_BUILD_TYPE=Debug path/to/sourcecode/
    
  2. Build the tntn-tests target
    VERBOSE=1 make tntn-tests
    

Usage

The tin-terrain command-line tool has a few subcommands. You can run tin-terrain --help to see all available subcommands.

$ tin-terrain --help
usage:
  tin-terrain [OPTION]... <subcommand> ...

Global Options:
  -h [ --help ]               print this help message
  --log arg (=stdout)         diagnostics output/log target, can be stdout,
                              stderr, or none
  -v [ --verbose ] [=arg(=1)] be more verbose
  --subcommand arg            command to execute
  --subargs arg               arguments for command

available subcommands:
  dem2tin - convert a DEM into a mesh/tin
  dem2tintiles - convert a DEM into mesh/tin tiles
  benchmark - run all available meshing methods on a given set of input files and produce statistics (performance, error rate)
  version - print version information

Projections

The tin-terrain tool requires your datasets to be in the Web Mercator projection (EPSG:3857). If your datasets are not in this projection, you can quite easily reproject your datasets with gdalwarp, e.g.:

gdalwarp -t_srs EPSG:3857 ned19_n37x75_w122x50_ca_goldengate_2010.img ned19_n37x75_w122x50_ca_goldengate_2010_mercator.tif

Creating a single mesh/TIN

You can use the dem2tin subcommand to convert a raster heightmap into a single big mesh/TIN in the OBJ format.

You can see all available options by running tin-terrain dem2tin --help.

$ tin-terrain dem2tin --help
usage:
  tin-terrain dem2tin [OPTIONS]...

dem2tin options:
  --input arg                 input filename
  --input-format arg (=auto)  input file format, can be any of: auto, asc, xyz,
                              tiff
  --output arg                output filename
  --output-format arg (=auto) output file format, can be any of: auto, obj,
                              off, terrain (quantized mesh), json/geojson
  --method arg (=terra)       meshing method, valid values are: terra, zemlya and dense
  --max-error arg             (terra & zemlya) maximum geometric error
  --step arg (=1)		      (dense) grid spacing in pixels


methods:
  terra     - implements a delaunay based triangulation with point selection using a fast greedy insert mechnism
    reference: Garland, Michael, and Paul S. Heckbert. "Fast polygonal approximation of terrains and height fields." (1995).
    paper: https://mgarland.org/papers/scape.pdf
    and http://mgarland.org/archive/cmu/scape/terra.html
  zemlya    - hierarchical greedy insertion
    reference: Zheng, Xianwei, et al. "A VIRTUAL GLOBE-BASED MULTI-RESOLUTION TIN SURFACE MODELING AND VISUALIZETION METHOD." International Archives of the Photogrammetry, Remote Sensing & Spatial Information Sciences 41 (2016).
    paper: https://www.int-arch-photogramm-remote-sens-spatial-inf-sci.net/XLI-B2/459/2016/isprs-archives-XLI-B2-459-2016.pdf
  dense     - generates a simple mesh grid from the raster input by placing one vertex per pixel

For example, you can run the following command to convert "ned19_n37x75_w122x50_ca_goldengate_2010_mercator.tif" to a single big mesh, using a max-error parameter of 2.0 meters:

tin-terrain dem2tin --input /data/ned19_n37x75_w122x50_ca_goldengate_2010_mercator.tif --output /data/terrain.obj --max-error 2.0

After running this command, you should see a "terrain.obj" output file in the same directory. This OBJ file contains the generated mesh.

The max-error parameter specifies the vertical error allowance in meters, so a smaller max-error parameter results in more triangles in the output mesh, better mesh quality, and longer running time.

Creating a pyramid of mesh/TIN tiles

The dem2tintiles subcommand takes a raster heightmap as the input, and creates tiled TIN mesh for a given zoom range. The output tiles can be either in the OBJ format or in the quantized-mesh-1.0 terrain format.

You can see all available options by running tin-terrain dem2tintiles --help.

$ tin-terrain dem2tintiles --help
usage:
  tin-terrain dem2tintiles [OPTION]...

dem2tintiles options:
  --input arg                    input filename
  --output-dir arg (=./output)
  --max-zoom arg (=-1)           maximum zoom level to generate tiles for. will
                                 guesstimate from resolution if not provided.
  --min-zoom arg (=-1)           minimum zoom level to generate tiles for will
                                 guesstimate from resolution if not provided.
  --max-error arg                (terra or zemlya) max error when using
  --step arg (=1)            	 (dense) grid spacing in pixels
  --output-format arg (=terrain) output tiles in terrain (quantized mesh) or
                                 obj
  --method arg (=terra)          meshing algorithm. one of: terra, zemlya or dense

For example, you can run the following command to convert "ned19_n37x75_w122x50_ca_goldengate_2010_mercator.tif" to a pyramid of mesh tiles.

tin-terrain dem2tintiles --input /data/ned19_n37x75_w122x50_ca_goldengate_2010_mercator.tif --output-dir /data/output --min-zoom 5 --max-zoom 14 --output-format=terrain --max-error 2.0

When this command finishes running, you should see an output folder containing all the mesh tiles, organized into a pyramid of subfolders.

├── 10
│   ├── 163
│   │   ├── 627.terrain
│   │   └── 628.terrain
│   └── 164
│       ├── 627.terrain
│       └── 628.terrain
...

The folder structure follows the map tile convention: Z/X/Y.terrain.

These mesh tiles can then be easily served from a webserver and be consumed by frontend applications for purposes such as terrain visualization.

Sample Datasets

When you enable the TNTN_TEST and TNTN_DOWNLOAD_DEPS options in the CMake configuration, a few sample datasets will be downloaded into the ${CMAKE_SOURCE_DIR}/3rdparty/ folder.

For example, you will find the crater lake dataset in the ${CMAKE_SOURCE_DIR}/3rdparty/craterlake folder. This dataset is created and maintained by the U.S. Geological Survey (USGS) and can be downloaded from http://oe.oregonexplorer.info/craterlake/.

To generate a mesh from this dataset, you need to reproject it to the Web Mercator projection first, using the gdalwarp command-line tool which comes with your GDAL installation:

gdalwarp -t_srs EPSG:3857 -r cubic -of GTiff -ot Float32 dems_10m.dem dems_10m.tif

Then you can run tin-terrain on this reprojected GeoTIFF file to create a mesh:

./tin-terrain dem2tin --input dems_10m.tif --output terrain.obj --max-error 2.0 --method terra

License

Copyright (C) 2018 HERE Europe B.V.

See the LICENSE file in the root of this project for license details.

Papers

Some algorithms are based on ideas from:

Comments
  • Terrain shadow

    Terrain shadow

    Unless I'm wrong. The Cesium.SceneMode.SCENE3D is not supported because the normal are not included in the tiles? Do you plan to add normal / allow shadow / SCENE3D?

    opened by frodrigo 19
  • tiling zoom lvl -1 fails

    tiling zoom lvl -1 fails

    Creating tile: 0,1
    after clipping: 167 triangles in tile
    writer log: {
            "QuantizedMeshHeader_start": 0
            "VertexData_vertexCount_start": 88
            "VertexData_vertexCount": 123
            "VertexData_u_start": 92
            "VertexData_v_start": 338
            "VertexData_height_start": 584
            "IndexData_bits": 16
            "IndexData_triangleCount_start": 830
            "IndexData_triangleCount": 167
            "IndexData_indices_start": 834
    }
    
    Processing zoom level -1, raster size 113x150
    ERROR cmd.cpp:211 zero partitions in zoom level, skipping
    

    with the given dataset

    PS C:\dev\tin-terrain> docker run --rm -v c:/geoids:/data geodata/gdal gdalinfo egm2008-1-wgs84.tif
    Driver: GTiff/GeoTIFF
    Files: egm2008-1-wgs84.tif
    Size is 14558, 19269
    Coordinate System is:
    PROJCS["WGS 84 / Pseudo-Mercator",
        GEOGCS["WGS 84",
            DATUM["WGS_1984",
                SPHEROID["WGS 84",6378137,298.257223563,
                    AUTHORITY["EPSG","7030"]],
                AUTHORITY["EPSG","6326"]],
            PRIMEM["Greenwich",0,
                AUTHORITY["EPSG","8901"]],
            UNIT["degree",0.0174532925199433,
                AUTHORITY["EPSG","9122"]],
            AUTHORITY["EPSG","4326"]],
        PROJECTION["Mercator_1SP"],
        PARAMETER["central_meridian",0],
        PARAMETER["scale_factor",1],
        PARAMETER["false_easting",0],
        PARAMETER["false_northing",0],
        UNIT["metre",1,
            AUTHORITY["EPSG","9001"]],
        AXIS["X",EAST],
        AXIS["Y",NORTH],
        EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m [email protected] +wktext +no_defs"],
        AUTHORITY["EPSG","3857"]]
    Origin = (-20037504.039667639881372,26520631.129502959549427)
    Pixel Size = (2752.732241633115791,-2752.732241633115791)
    Metadata:
      AREA_OR_POINT=Area
      TIFFTAG_IMAGEDESCRIPTION=VERT_DATUM["EGM2008 geoid",2005,AUTHORITY["EPSG","1027"]]
    Image Structure Metadata:
      INTERLEAVE=BAND
    Corner Coordinates:
    Upper Left  (-20037504.040,26520631.130) (179d59'59.86"W, 88d12'29.40"N)
    Lower Left  (-20037504.040,-26521766.435) (179d59'59.86"W, 88d12'30.55"S)
    Upper Right (20036771.934,26520631.130) (179d59'36.19"E, 88d12'29.40"N)
    Lower Right (20036771.934,-26521766.435) (179d59'36.19"E, 88d12'30.55"S)
    Center      (    -366.053,    -567.653) (  0d 0'11.84"W,  0d 0'18.36"S)
    Band 1 Block=14558x1 Type=Float32, ColorInterp=Gray
      NoData Value=-32767
      Unit Type: metre
    

    using the following command

    docker run --rm -v c:/geoids:/data earthml/tin-terrain tin-terrain dem2tintiles --input /data/egm2008-1-wgs84.tif --output-dir /data/egm2008-1-tiles --max-error 2.0 --output-format terrain
    
    opened by pksorensen 12
  • Segfault in GDALCopyWord on big GeoTIFF

    Segfault in GDALCopyWord on big GeoTIFF

    On a 68036x65743 GeoTIFF I got the following error:

    $ gdb --args ./tin-terrain dem2tin --method terra --max-error 10 --input /tmp//DGM1_2x2KM_XYZ_HH_2018_01_17_3857_p2deflate.tif --output /tmp/test.obj
    GNU gdb (GDB) 8.2
    Copyright (C) 2018 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Type "show copying" and "show warranty" for details.
    This GDB was configured as "x86_64-pc-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
        <http://www.gnu.org/software/gdb/documentation/>.
    
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from ./tin-terrain...done.
    (gdb) run
    Starting program: /tmp/tools/tin-terrain/build-cmake-release/tin-terrain dem2tin --method terra --max-error 10 --input /tmp//DGM1_2x2KM_XYZ_HH_2018_01_17_3857_p2deflate.tif --output /tmp/test.obj
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/usr/lib/libthread_db.so.1".
    subcommand_dem2tin
    DEBUG gdal_init.cpp:14 calling GDALAllRegister...
    Opening raster file /tmp//DGM1_2x2KM_XYZ_HH_2018_01_17_3857_p2deflate.tif with GDAL...
    reading raster data...
    
    Program received signal SIGSEGV, Segmentation fault.
    0x00007ffff760ba9f in GDALCopyWord ([email protected]: 6.68388536893727e-265, fValueIn=<optimized out>) at gdal_priv_templates.hpp:173
    173	gdal_priv_templates.hpp: No such file or directory.
    (gdb) bt
    #0  0x00007ffff760ba9f in GDALCopyWord ([email protected]: 6.68388536893727e-265, fValueIn=<optimized out>) at gdal_priv_templates.hpp:173
    #1  (anonymous namespace)::GDALCopyWordsGenericT<float, double> (nWordCount=<optimized out>, nDstPixelStride=<optimized out>, pDstData=<optimized out>, 
        nSrcPixelStride=<optimized out>, pSrcData=<optimized out>) at rasterio.cpp:1960
    #2  (anonymous namespace)::GDALCopyWordsT<float, double> (nWordCount=<optimized out>, nDstPixelStride=<optimized out>, pDstData=<optimized out>, 
        nSrcPixelStride=<optimized out>, pSrcData=<optimized out>) at rasterio.cpp:1973
    #3  (anonymous namespace)::GDALCopyWordsFromT<float> (pSrcData=<optimized out>, nSrcPixelStride=4, bInComplex=<optimized out>, pDstData=<optimized out>, 
        eDstType=<optimized out>, nDstPixelStride=8, nWordCount=256) at rasterio.cpp:2607
    #4  0x00007ffff76138b0 in GDALRasterBand::IRasterIO ([email protected]=0x555555851f70, [email protected]=GF_Read, nXOff=<optimized out>, [email protected]=0, 
        nYOff=<optimized out>, [email protected]=0, nXSize=<optimized out>, [email protected]=68036, nYSize=<optimized out>, [email protected]=65743, pData=0x7fff9794c010, 
        nBufXSize=68036, nBufYSize=65743, eBufType=GDT_Float64, nPixelSpace=8, nLineSpace=544288, psExtraArg=0x7fffffffd5b0) at rasterio.cpp:416
    #5  0x00007ffff727daec in GTiffRasterBand::IRasterIO (this=0x555555851f70, eRWFlag=GF_Read, nXOff=0, nYOff=0, nXSize=68036, nYSize=65743, pData=0x7fff9794c010, 
        nBufXSize=68036, nBufYSize=65743, eBufType=GDT_Float64, nPixelSpace=8, nLineSpace=544288, psExtraArg=0x7fffffffd5b0) at geotiff.cpp:4222
    #6  0x00007ffff75f591d in GDALRasterBand::RasterIO (this=0x555555851f70, eRWFlag=GF_Read, nXOff=0, nYOff=0, nXSize=68036, nYSize=<optimized out>, 
        pData=0x7fff9794c010, nBufXSize=68036, nBufYSize=65743, eBufType=GDT_Float64, nPixelSpace=8, nLineSpace=544288, psExtraArg=0x7fffffffd5b0)
        at gdalrasterband.cpp:361
    #7  0x00005555557102f4 in tntn::load_raster_file (
        file_name="/tmp/DGM1_2x2KM_XYZ_HH_2018_01_17_3857_p2deflate.tif", target_raster=..., validate_projection=false) at /tmp/tools/tin-terrain/src/RasterIO.cpp:384
    #8  0x0000555555676b10 in tntn::subcommand_dem2tin (need_help=false, global_varmap=..., unrecognized=std::vector of length 8, capacity 16 = {...})
        at /tmp/tools/tin-terrain/src/cmd.cpp:351
    #9  0x0000555555679e01 in tntn::tin_terrain_commandline_action (args=std::vector of length 9, capacity 16 = {...})
        at /tmp/tools/tin-terrain/src/cmd.cpp:763
    #10 0x000055555567a6f0 in main (argc=10, argv=0x7fffffffe078) at /tmp/tools/tin-terrain/src/cmd.cpp:799
    (gdb) 
    
    

    If I scale it to 10% (6804x6574) it works fine.

    opened by kannes 8
  • Valid Quantized Mesh Header?

    Valid Quantized Mesh Header?

    I'm new to this stuff so apologies if this is user error or misunderstanding...

    The coordinate values in the quantized mesh header seem off. The quantized-mesh spec says coordinate values should be in earth-centered fixed coordinates. Given that, I'd expect the magnitude of the center point to be a value close to the radius of the earth, but that doesn't seem to be the case.

    As an example I ran dem2tintiles on the craterlake dem dataset.

    The resulting header for tile 6/10/40.terrain looks like:

    {
      "centerX": -13462700.917811524,
      "centerY": 5322463.153553393,
      "centerZ": 1331.456658194813,
      "minHeight": 1130.3309326171875,
      "maxHeight": 1532.5823974609375,
      "boundingSphereCenterX": -13462700.917811524,
      "boundingSphereCenterY": 5322463.153553393,
      "boundingSphereCenterZ": 1331.456658194813,
      "boundingSphereRadius": 885541.1267042665,
      "horizonOcclusionPointX": -13462700.917811524,
      "horizonOcclusionPointY": 5322463.153553393,
      "horizonOcclusionPointZ": 1532.5824073771364
    }
    

    which means the resulting magnitude for the center point is 14476633.994 which seems way off from the earth radius of 6378137

    opened by malaretv 4
  • dem2tin failure w/o actionable error msg

    dem2tin failure w/o actionable error msg

    I downloaded tin-terrain today and built the Docker image on my Mac.

    When I run dem2tin, I see the following failure:

    [email protected]:/home# tin-terrain dem2tin --input /data/LMI_Haedarlikan_DEM_16bit/LMI_Haedarlikan_DEM_16bit-Mercator.tif --output /data/LMI_Haedarlikan_DEM_16bit/test.obj subcommand_dem2tin Opening raster file /data/LMI_Haedarlikan_DEM_16bit/LMI_Haedarlikan_DEM_16bit-Mercator.tif with GDAL... reading raster data... Killed [email protected]:/home#

    My dataset:

    [email protected]:/home# gdalinfo /data/LMI_Haedarlikan_DEM_16bit/LMI_Haedarlikan_DEM_16bit-Mercator.tif Driver: GTiff/GeoTIFF Files: /data/LMI_Haedarlikan_DEM_16bit/LMI_Haedarlikan_DEM_16bit-Mercator.tif Size is 56541, 39914 Coordinate System is: PROJCS["WGS 84 / Pseudo-Mercator", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.0174532925199433, AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","4326"]], PROJECTION["Mercator_1SP"], PARAMETER["central_meridian",0], PARAMETER["scale_factor",1], PARAMETER["false_easting",0], PARAMETER["false_northing",0], UNIT["metre",1, AUTHORITY["EPSG","9001"]], AXIS["X",EAST], AXIS["Y",NORTH], EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m [email protected] +wktext +no_defs"], AUTHORITY["EPSG","3857"]] Origin = (-2764161.621573575772345,10052026.112180622294545) Pixel Size = (23.488512876275621,-23.488512876275621) Metadata: AREA_OR_POINT=Area DataType=Generic Image Structure Metadata: INTERLEAVE=BAND Corner Coordinates: Upper Left (-2764161.622,10052026.112) ( 24d49'51.19"W, 66d37'55.54"N) Lower Left (-2764161.622, 9114505.609) ( 24d49'51.19"W, 63d 3'29.08"N) Upper Right (-1436097.615,10052026.112) ( 12d54' 2.46"W, 66d37'55.54"N) Lower Right (-1436097.615, 9114505.609) ( 12d54' 2.46"W, 63d 3'29.08"N) Center (-2100129.618, 9583265.861) ( 18d51'56.83"W, 64d54'16.26"N) Band 1 Block=56541x1 Type=Int16, ColorInterp=Gray NoData Value=-10000 Metadata: BandName=Band_1 SourceBandIndex=0 [email protected]:/home#

    Since I downloaded rather than cloned, not much here. But I did this today:

    [email protected]:/home# tin-terrain version name: tin-terrain copyright_notice: Copyright (C) 2018 HERE Europe B.V. git_description: git_hash: build_timestamp: 20181130T2116Z [email protected]:/home#

    I've tried the verbose switch and the log option, but there is no additional information to help me decide what to try next. Any suggestions would be much appreciated.

    opened by moosehill 4
  • Error while building and installing

    Error while building and installing

    error: parameter declared ‘auto’ std::for_each(begin, end, [this](const auto& v) { add(v); }); error: ‘v’ was not declared in this scope std::for_each(begin, end, [this](const auto& v) { add(v); }); error: ‘make_unique’ is not a member of ‘std’ TileMaker() : m_mesh(std::make_unique()) {} error: expected primary-expression before ‘>’ token TileMaker() : m_mesh(std::make_unique()) {} error: expected primary-expression before ‘)’ token TileMaker() : m_mesh(std::make_unique()) {}

    opened by Girishchandra-Yendargaye 3
  • "Killed" ... Memory usage?

    I'm trying to run dem2tintiles via docker and see the message "Killed" very quickly when I run dem2tintiles on a fairly normal (16GB RAM) Windows PC:

    `

    docker run -v e::/data:cached --name tin-terrain --rm -m 8g --memory-swap 128g --oom-kill-disable -i -t tin-terrain bash `

    [email protected]:/home# /usr/local/bin/tin-terrain dem2tintiles --input /data/merit.tif --output-dir /data/output --min-zoom 5 --max-zoom 14 --output-format=terrain --max-error 2.0 Opening raster file /data/merit.tif with GDAL... reading raster data... Killed

    My image is large (500gB): `

    gdalinfo merit.tif Driver: GTiff/GeoTIFF Files: merit.tif merit.tif.ovr Size is 432000, 305835 Coordinate System is: PROJCS["WGS 84 / Pseudo-Mercator", ... Band 1 Block=256x256 Type=Float32, ColorInterp=Gray NoData Value=-9999 Overviews: 108000x76459, 27000x19115, 6750x4779, 1688x1195 `

    I believe that I'm running out of memory, but what sort of memory usage should I expect? Is there any sort of DEM 'windowing' to limit memory usage? Is there another way to organize my data differently to not require absurd amounts of memory?

    opened by wthorp 3
  • No layers.json

    No layers.json

    In order for CesiumJS to work, I've found it needs a layers.json file to know what tiles are available, their details, projection, etc. This is not produced by dem2tintiles.

    opened by BTolputt 3
  • Tiling Issue - No Zoom Level 1 or 0

    Tiling Issue - No Zoom Level 1 or 0

    Using a freely available height DEM from Earth Explorer (ASTGTM2_S37E148_dem) - dem2tintiles results in a truncated set of zoom levels. Level 1 results in the message below, no level 0 is generated.

    after clipping: 0 triangles in tile
    WARN cmd.cpp:206 raster on zoom level 0 empty, cannot create tiles, proceeding...
    

    Zoom levels 2-6 are only generated if I force them by setting "max-zoom". ASTGTM2_S37E148_dem.tif.zip

    opened by BTolputt 3
  • Compilation problem

    Compilation problem

    Hello:

    I am trying to compile the sources following the instructions on a 18.04 linux server machine with gdal 2.2.3 installed. This is the error:

    [ 52%] Building CXX object CMakeFiles/tntn.dir/src/RasterIO.cpp.o /usr/bin/c++ -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_SWIZZLE -I/mnt/data1/srtm30/tin-terrain-master/3rdparty/glm-0.9.9.0 -I/mnt/data1/srtm30/tin-terrain-master/include -I/usr/include/gdal -I/mnt/data1/srtm30/tin-terrain-master/3rdparty/fmt-5.1.0/include -O3 -DNDEBUG -std=gnu++14 -o CMakeFiles/tntn.dir/src/RasterIO.cpp.o -c /mnt/data1/srtm30/tin-terrain-master/src/RasterIO.cpp /mnt/data1/srtm30/tin-terrain-master/src/RasterIO.cpp: In function ‘bool tntn::is_valid_projection(GDALDataset*)’: /mnt/data1/srtm30/tin-terrain-master/src/RasterIO.cpp:290:44: error: no matching function for call to ‘OGRSpatialReference::importFromWkt(const char*&)’ raster_srs.importFromWkt(projection_wkt); ^ In file included from /mnt/data1/srtm30/tin-terrain-master/src/RasterIO.cpp:14:0: /usr/include/gdal/ogr_spatialref.h:185:17: note: candidate: OGRErr OGRSpatialReference::importFromWkt(char**) OGRErr importFromWkt( char ** ); ^~~~~~~~~~~~~ /usr/include/gdal/ogr_spatialref.h:185:17: note: no known conversion for argument 1 from ‘const char*’ to ‘char**’ /mnt/data1/srtm30/tin-terrain-master/src/RasterIO.cpp:316:24: error: ‘class OGRSpatialReference’ has no member named ‘FindMatches’ raster_srs.FindMatches(NULL, &matches_number, NULL); ^~~~~~~~~~~ /mnt/data1/srtm30/tin-terrain-master/src/RasterIO.cpp:335:9: error: ‘OSRFreeSRSArray’ was not declared in this scope OSRFreeSRSArray(matched_projections); ^~~~~~~~~~~~~~~ CMakeFiles/tntn.dir/build.make:470: recipe for target 'CMakeFiles/tntn.dir/src/RasterIO.cpp.o' failed make[3]: *** [CMakeFiles/tntn.dir/src/RasterIO.cpp.o] Error 1 make[3]: Leaving directory '/mnt/data1/srtm30/tin-terrain-master/build' CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/tntn.dir/all' failed make[2]: *** [CMakeFiles/tntn.dir/all] Error 2 make[2]: Leaving directory '/mnt/data1/srtm30/tin-terrain-master/build' CMakeFiles/Makefile2:117: recipe for target 'CMakeFiles/tin-terrain.dir/rule' failed make[1]: *** [CMakeFiles/tin-terrain.dir/rule] Error 2 make[1]: Leaving directory '/mnt/data1/srtm30/tin-terrain-master/build' Makefile:131: recipe for target 'tin-terrain' failed make: *** [tin-terrain] Error 2

    No idea what is the problem... please help Thanks

    opened by raul-geocento 3
  • single quantized mesh from tiff

    single quantized mesh from tiff

    Is it possible to use dem2tin to create a single quantized mesh file using a tiff input?

    Whenever I run dem2tin with the option --output-format terrain it fails:

    ./tin-terrain dem2tin --input baty.tif --output bathy.terrain
      --input-format tiff --output-format terrain --method terra
    subcommand_dem2tin
    Opening raster file baty.tif with GDAL...
    reading raster data...
    done
    performing terra meshing...
    starting greedy insertion with raster width: 1386, height: 1421
    initialize the mesh with four corner points
    finished greedy insertion
    done
    time for meshing step: 0.365798 sec = 0.00609663 minutes
    number of triangles: 41894
    number of vertices: 20950
    writing mesh... (bathy.terrain)
    ERROR QuantizedMeshIO.cpp:327 Mesh has to be triangulated in order to be written as QM
    ERROR cmd.cpp:453 error writing output file
    

    When I choose to output an .obj file instead it works fine and if I manually inspect the resulting mesh it looks perfectly triangulated. The error message is confusing since the meshing process seem to work. I tried all methods and multiple inputs including the example files from your readme. I also ran gdalwarp to transform my data into the correct projection.

    dem2tintiles is producing valid quantized meshes on the same .tiff files.

    Any help would be appreciated!

    opened by frapit 2
  • Got the following error while installing

    Got the following error while installing

    I'm running it on a Linux.

    $ cmake -DCMAKE_BUILD_TYPE=Release path/to/sourcecode/
    CMake Error: The source directory "/home/xxxxx/projects/tin-terrain/build-cmake-release/path/to/sourcecode" does not appear to contain CMakeLists.txt.
    Specify --help for usage, or press the help button on the CMake GUI.
    

    Changed the cmake path then got the following error:

    $ cmake -DCMAKE_BUILD_TYPE=Release ..
    -- file /home/xxxxx/projects/tin-terrain/3rdparty/libfmt-5.1.0.tar.gz already downloaded and unpacked, not doing anything
    -- file /home/xxxxx/projects/tin-terrain/3rdparty/libglm-0.9.9.0.tar.gz already downloaded and unpacked, not doing anything
    -- file /home/xxxxx/projects/tin-terrain/3rdparty/Catch2-2.3.0/catch.hpp already downloaded and unpacked, not doing anything
    -- CMake version: 3.22.1
    -- Version: 5.1.0
    -- Build type: Release
    -- CXX_STANDARD: 14
    -- Configuring done
    CMake Error in CMakeLists.txt:
      Imported target "Boost::program_options" includes non-existent path
    
        "/include"
    
      in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:
    
      * The path was deleted, renamed, or moved to another location.
    
      * An install or uninstall procedure did not complete successfully.
    
      * The installation package was faulty and references files it does not
      provide.
    
    
    
    CMake Error in CMakeLists.txt:
      Imported target "Boost::program_options" includes non-existent path
    
        "/include"
    
      in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:
    
      * The path was deleted, renamed, or moved to another location.
    
      * An install or uninstall procedure did not complete successfully.
    
      * The installation package was faulty and references files it does not
      provide.
    
    
    opened by ruanqizhen 0
  • create quantized-mesh of obj-mesh

    create quantized-mesh of obj-mesh

    is it possible to create a quantized-mesh from obj geometry? does not work(( tin-terrain dem2tin --input E:/test_terrain/Tin-Terrain/data/my3857.xyz --input-format xyz --output E:/test_terrain/Tin-Terrain/data/ttt.terrain --output-format terrain --max-error 2.0

    ERROR 4: `E:/test_terrain/Tin-Terrain/data/my3857.xyz' not recognized as a supported file format.

    image

    opened by nikolos82 0
  • Removed the specific ubuntu version

    Removed the specific ubuntu version

    Fix #73 Build Error - caused by 'no release file' error and errors: E: The repository 'http://security.ubuntu.com/ubuntu cosmic-security Release' does not have a Release file. E: The repository 'http://archive.ubuntu.com/ubuntu cosmic Release' does not have a Release file. E: The repository 'http://archive.ubuntu.com/ubuntu cosmic-updates Release' does not have a Release file. E: The repository 'http://archive.ubuntu.com/ubuntu cosmic-backports Release' does not have a Release file.

    opened by fnicollet 0
  • dem2tintiles layer.json missing

    dem2tintiles layer.json missing

    AFAIK, when it comes to tiles, there is a file with the metadata. For example, while we tile a raster, there is always a layer.json file that gets used by OL or Cesium initially. But the dem2tintiles does not create that file. Is that intended or am I missing something?

    opened by iyush1993 1
  • Build Error - caused by 'no release file' error

    Build Error - caused by 'no release file' error

    Running build-docker.sh results in the following output:

    Sending build context to Docker daemon 10.44 MB
    Step 1/18 : FROM ubuntu:18.10
     ---> 9dc19675e327
    Step 2/18 : RUN apt-get update
     ---> Running in 17c69c3ada81
    
    Ign:1 http://archive.ubuntu.com/ubuntu cosmic InRelease
    Ign:2 http://security.ubuntu.com/ubuntu cosmic-security InRelease
    Ign:3 http://archive.ubuntu.com/ubuntu cosmic-updates InRelease
    Err:4 http://security.ubuntu.com/ubuntu cosmic-security Release
      404  Not Found [IP: 91.189.88.142 80]
    Ign:5 http://archive.ubuntu.com/ubuntu cosmic-backports InRelease
    Err:6 http://archive.ubuntu.com/ubuntu cosmic Release
      404  Not Found [IP: 91.189.88.142 80]
    Err:7 http://archive.ubuntu.com/ubuntu cosmic-updates Release
      404  Not Found [IP: 91.189.88.142 80]
    Err:8 http://archive.ubuntu.com/ubuntu cosmic-backports Release
      404  Not Found [IP: 91.189.88.142 80]
    Reading package lists...
    E: The repository 'http://security.ubuntu.com/ubuntu cosmic-security Release' does not have a Release file.
    E: The repository 'http://archive.ubuntu.com/ubuntu cosmic Release' does not have a Release file.
    E: The repository 'http://archive.ubuntu.com/ubuntu cosmic-updates Release' does not have a Release file.
    E: The repository 'http://archive.ubuntu.com/ubuntu cosmic-backports Release' does not have a Release file.
    The command '/bin/sh -c apt-get update' returned a non-zero code: 100
    

    I was able to build the image successfully by replacing line 1 in Dockerfile with "FROM ubuntu" (just removed the versioning). Is this an error from my end, or is this something that needs to be updated in the repository?

    opened by alexbeeston 5
Owner
HERE Technologies
HERE Technologies, the leading location cloud.
HERE Technologies
pbr2gltf2 is a command line tool for converting PBR images to a glTF 2.0 material.

pbr2gltf2 is a command line tool for converting PBR images to a glTF 2.0 material. The tool is detecting depending on the filename, which PBR information is stored. It swizzles the images and does reassign the channels to a glTF 2.0 image. The tool stores the images plus a minimal, valid glTF 2.0 file containing the required material, textures and images.

UX3D GmbH 23 Jul 31, 2022
Slow5tools is a toolkit for converting (FAST5 <-> SLOW5), compressing, viewing, indexing and manipulating data in SLOW5 format.

slow5tools Slow5tools is a simple toolkit for converting (FAST5 <-> SLOW5), compressing, viewing, indexing and manipulating data in SLOW5 format. Abou

Hasindu Gamaarachchi 51 Sep 9, 2022
C/C++ library for converting a stream of OPL FM synth chip commands to the OPB music format

OPBinaryLib C/C++ library for converting a stream of OPL FM synth chip commands to the OPB music format Basic usage Store your OPL commands as a conti

Emma Maassen 10 Feb 2, 2022
This command-line tool converts an FM broadcast signal into stereo sound with de-emphasis applied.

stereodemux This command-line tool converts an FM broadcast signal into stereo sound with de-emphasis applied. It expects 16-bit signed-integer MPX (F

Oona Räisänen 11 Sep 6, 2022
nicegraf-shaderc is a command-line tool that transforms HLSL code into shaders for various graphics APIs.

User Manual Table of Contents Introduction Project Status Obtaining the Source Code and Building Running Defining Techniques Generated Header File Pip

nicebyte 94 Sep 20, 2022
led is a line-oriented text editor in command line

led is a line-oriented text editor in command line. This editor is similar to the standard program on unix systems - GNU ed. But i'm not going to make an exact clone of that program, it's just a pet project.

Artem Mironov 13 Oct 4, 2022
Draco is a library for compressing and decompressing 3D geometric meshes and point clouds.

Draco is a library for compressing and decompressing 3D geometric meshes and point clouds. It is intended to improve the storage and transmission of 3D graphics.

Google 5.2k Oct 4, 2022
physically based renderer written in DX12 with image-based lighting, classic deffered and tiled lighting approaches

Features Classical Deferred Renderer Physically Based shading Image Based Lighting BRDF Disney model (Burley + GGX) Tangent space normal mapping Reinh

Alena 35 Jun 2, 2022
The Implementation of quadtree-based multi-thread tiled pyramid building algorithm.

tile-map-parallel-builder Quadtree-based multi-thread tiled pyramid building algorithm. Core Concept NOTE: The level is different from TMS zoom level.

Shepard 5 May 16, 2022
tiny_csg is a C++ library that generates meshes from brush-based level data and supports incremental updates (real-time CSG).

tiny_csg is a C++ library that generates meshes from brush-based level data and supports incremental updates (real-time CSG). It is intended to be used as a backend in 3d level editors and/or generators.

Luka Aleksić 31 Sep 25, 2022
A lightweight C++14 parsing library for tmx map files created with the Tiled map editor

tmxlite Description A lightweight C++14 parsing library for tmx map files created with the Tiled map editor. Requires no external linking, all depende

Matt Styles 322 Oct 3, 2022
Polyscope is a C++/Python viewer and user interface for 3D data such as meshes and point clouds

Polyscope is a C++/Python viewer and user interface for 3D data such as meshes and point clouds. It allows you to register your data and quickly generate informative and beautiful visualizations, either programmatically or via a dynamic GUI.

Nicholas Sharp 1.2k Oct 4, 2022
SPIRV-Cross is a tool designed for parsing and converting SPIR-V to other shader languages.

SPIRV-Cross SPIRV-Cross is a tool designed for parsing and converting SPIR-V to other shader languages. Features Convert SPIR-V to readable, usable an

The Khronos Group 1.5k Sep 30, 2022
LZFSE compression library and command line tool

LZFSE This is a reference C implementation of the LZFSE compressor introduced in the Compression library with OS X 10.11 and iOS 9. LZFSE is a Lempel-

null 1.7k Sep 29, 2022
Library and command line tool to detect SHA-1 collision in a file

sha1collisiondetection Library and command line tool to detect SHA-1 collisions in files Copyright 2017 Marc Stevens [email protected] Distributed

Marc Stevens 1.2k Sep 28, 2022
Warp speed Data Transfer (WDT) is an embeddedable library (and command line tool) aiming to transfer data between 2 systems as fast as possible over multiple TCP paths.

WDT Warp speed Data Transfer Design philosophy/Overview Goal: Lowest possible total transfer time - to be only hardware limited (disc or network bandw

Facebook 2.7k Oct 2, 2022
The approximate regex matching library and agrep command line tool.

Introduction TRE is a lightweight, robust, and efficient POSIX compliant regexp matching library with some exciting features such as approximate (fuzz

Ville Laurikari 687 Sep 12, 2022
FCracker is a command line tool designed to brute force encrypted files like zip, 7z, rar, pdf etc.

FCrack is a command-line tool designed to brute force encrypted files like zip, 7z, rar, pdf, gpg etc.

null 21 Oct 3, 2022
A command-line tool to display colorful distro information.

sjfetch A command-line tool to display colorful distro information.

Fikret Musk 6 Apr 6, 2022
animation2gltf2 is a command line tool for generating animation glTF 2.0 content.

Generate animation glTF 2.0 content animation2gltf2 is a command line tool for generating animation glTF 2.0 content. A rotation and translation can b

UX3D GmbH 7 Jan 9, 2022