Forum Replies Created

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

    Have you read this:
    https://github.com/zsiki/SARndbox_util/blob/master/README.md

    Code was tested with Python 2 only.

    in reply to: DEM Help #103012
    siki
    Participant

    @abcottrell
    I’ve created a a repo (https://github.com/zsiki/SARndbox_util), 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 dem2grid.py 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.

    @jKrienert
    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
    siki
    Participant

    Thanks, it is not my case.

    in reply to: Terrian model? #102894
    siki
    Participant

    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

    https://github.com/zsiki/SARndbox_util

    in reply to: DEM Help #102893
    siki
    Participant

    I’ve finished the grid->dem conversion too. Both tools (dem2grid.py, grid2dem.py) are available on github.com
    I’ve tested using Python 2.7.
    See https://github.com/zsiki/SARndbox_util

    Testers are highly welcome

    in reply to: DEM Help #102889
    siki
    Participant

    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 siki.zoltan@epito.bme.hu

    Usage:
    python dem2grid.py input.dem [output.grid]
    or
    dem2grid.py 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: dem2grid.py input.dem output.grid”)
    sys.exit(1)
    ifilename = sys.argv[1]
    # generate output file name if not given on the command line
    if len(sys.argv) > 2:
    ofilename = sys.argv[2]
    else:
    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”);
    sys.exit(2)
    # 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))
    of.close()

    in reply to: DEM Help #102888
    siki
    Participant

    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
    siki
    Participant

    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
    siki
    Participant

    The same true for SARndbox-2.3 in case of
    CalibrateProjector

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