Forum Replies Created

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • in reply to: DEM Help #116627
    in reply to: DEM Help #115649

    Have you read this:

    Code was tested with Python 2 only.

    in reply to: DEM Help #103012

    I’ve created a a repo (, there you can find a short description.
    There is only one obligatory parameter the input file.
    So if there is no need for offset and scale the elevations the command line should be:

    python your_dem_file

    This case the output will have the same name as the input, only the extension will be changed (output will be written to the same folder as the input file.


    If you set the input file in the code you lose flexibility, you have to change the source code if you want to use the code for a different input file.

    in reply to: make Kinect-3.2 #102899

    Thanks, it is not my case.

    in reply to: Terrian model? #102894

    I’ve also created a similar tool in Python. My tool converts the dem output of SARndbox direcly to grid format. It can be found on github

    in reply to: DEM Help #102893

    I’ve finished the grid->dem conversion too. Both tools (, are available on
    I’ve tested using Python 2.7.

    Testers are highly welcome

    in reply to: DEM Help #102889

    The “Short read by” error was my mistake (using 2 byte integers instead of 4 bytes). I’ve just finished my small utility which convert dem file to grid file. The code is beta, no extensive tests were made. It is written in Python (tested in Python 2.7 but is should run in python 3 too).
    Here it is:

    Convert USGS ASCII DEM file to SARnbox grid format
    (c) Zoltan Siki

    python input.dem [output.grid]
    or input.dem [output.dgrid]

    import sys
    import os
    import osgeo.gdal
    from gdalconst import *
    import struct

    # check command line parameters
    if len(sys.argv) <= 1:
    print(“Usage: input.dem output.grid”)
    ifilename = sys.argv[1]
    # generate output file name if not given on the command line
    if len(sys.argv) > 2:
    ofilename = sys.argv[2]
    ofilename = os.path.splitext(ifilename)[0] + “.grid”
    # use gdal to read USGS DEM file
    idataset = osgeo.gdal.Open(ifilename, GA_ReadOnly)
    if idataset is None:
    print(“Cant read input file”);
    # get size of dem
    cols = idataset.RasterXSize
    rows = idataset.RasterYSize
    # get and calculate coordinate limits
    tr = idataset.GetGeoTransform()
    xul = tr[0]
    yul = tr[3]
    xlr = xul + (cols – 1) * tr[1]
    ylr = yul + (rows – 1) * tr[5]
    # write data to binary output
    of = open(ofilename, “wb”)
    of.write(struct.pack(“2i”, cols, rows))
    of.write(struct.pack(“4f”, xul, ylr, xlr, yul))
    band = idataset.GetRasterBand(1)
    of.write(band.ReadRaster(0, 0, cols, rows, cols, rows, band.DataType))

    in reply to: DEM Help #102888

    I’ve started to write a small python utility program which converts the saved output USGS DEM file to input binary grid format. The saved bathymetry file contains 639 rows and 480 columns. I thing there should be 640 rows in the output. Converting the DEM file to grid, SARnbox can’t read it I get a ‘Short read by 2854419504 bytes’ error message. That number is larger then the file size.

    in reply to: make Kinect-3.2 #102887

    Thanks for your answer.
    I made a mistake. After building Vrui-4.2-006 I noticed no libjpeg-dev installed on my Ubuntu 16.04 box, but forget to rebuild Vrui after installing libjpeg-dev (some header files were missed building Kinect-3.2).
    After “make clean”, and rebuilding Vrui and Kinect, it works without any problem.

    As looking over the Vrui make output I noticed Multithreaded rendering is disabled. What libraries should I install to enable multithreading?

    in reply to: make Kinect-3.2 #102880

    The same true for SARndbox-2.3 in case of

Viewing 10 posts - 1 through 10 (of 10 total)