Exemple #1
0
def run(oldpath, newpath):
    """
    Runs the 10th basic test suite. Tests:

    Importing SPDV3
    Creating spatial index
    creating a raster
    """
    inputLas = os.path.join(oldpath, INPUT_SPDV3)
    info = generic.getLidarFileInfo(inputLas)

    importedSPD = os.path.join(newpath, IMPORTED_SPD)
    translate(info, inputLas, importedSPD, scaling=SCALINGS)
    utils.compareLiDARFiles(os.path.join(oldpath, IMPORTED_SPD),
                            importedSPD,
                            windowSize=WINDOWSIZE)

    indexedSPD = os.path.join(newpath, INDEXED_SPD)
    createGridSpatialIndex(importedSPD,
                           indexedSPD,
                           binSize=2.0,
                           tempDir=newpath)
    utils.compareLiDARFiles(os.path.join(oldpath, INDEXED_SPD),
                            indexedSPD,
                            windowSize=WINDOWSIZE)

    outputDEM = os.path.join(newpath, OUTPUT_DEM)
    rasterize([indexedSPD],
              outputDEM, ['Z'],
              function="numpy.ma.min",
              atype='POINT',
              windowSize=WINDOWSIZE)
    utils.compareImageFiles(os.path.join(oldpath, OUTPUT_DEM), outputDEM)
Exemple #2
0
def run(oldpath, newpath):
    """
    Runs the first basic test suite. Tests:

    Importing LAS
    Creating spatial index
    creating a raster
    """
    inputLas = os.path.join(oldpath, INPUT_LAS)
    info = generic.getLidarFileInfo(inputLas)

    importedSPD = os.path.join(newpath, IMPORTED_SPD)
    translate(info, inputLas, importedSPD, epsg=28356, 
            pulseIndex='FIRST_RETURN', buildPulses=True)
    utils.compareLiDARFiles(os.path.join(oldpath, IMPORTED_SPD), importedSPD)

    indexedSPD = os.path.join(newpath, INDEXED_SPD)
    createGridSpatialIndex(importedSPD, indexedSPD, binSize=2.0, 
            tempDir=newpath)
    utils.compareLiDARFiles(os.path.join(oldpath, INDEXED_SPD), indexedSPD)

    outputDEM = os.path.join(newpath, OUTPUT_DEM)
    rasterize([indexedSPD], outputDEM, ['Z'], function="numpy.ma.min", 
            atype='POINT')
    utils.compareImageFiles(os.path.join(oldpath, OUTPUT_DEM), outputDEM)
    
Exemple #3
0
def run(oldpath, newpath):
    """
    Runs the 8th basic test suite. Tests:

    Importing Riegl
    Creating spatial index
    Create an image file
    updating resulting file
    """
    inputRiegl = os.path.join(oldpath, INPUT_RIEGL)
    info = generic.getLidarFileInfo(inputRiegl)

    importedSPD = os.path.join(newpath, IMPORTED_SPD)
    translate(info,
              inputRiegl,
              importedSPD,
              scalings=SCALINGS,
              internalrotation=True)
    utils.compareLiDARFiles(os.path.join(oldpath, IMPORTED_SPD),
                            importedSPD,
                            windowSize=WINDOWSIZE)

    indexedSPD = os.path.join(newpath, INDEXED_SPD)
    createGridSpatialIndex(importedSPD,
                           indexedSPD,
                           binSize=1.0,
                           tempDir=newpath)
    utils.compareLiDARFiles(os.path.join(oldpath, INDEXED_SPD),
                            indexedSPD,
                            windowSize=WINDOWSIZE)

    outputRaster = os.path.join(newpath, OUTPUT_RASTER)
    rasterize([indexedSPD],
              outputRaster, ['Z'],
              function="numpy.ma.min",
              atype='POINT',
              windowSize=WINDOWSIZE)
    utils.compareImageFiles(os.path.join(oldpath, OUTPUT_RASTER), outputRaster)

    outputUpdate = os.path.join(newpath, UPDATED_SPD)
    shutil.copyfile(indexedSPD, outputUpdate)

    dataFiles = lidarprocessor.DataFiles()
    dataFiles.input1 = lidarprocessor.LidarFile(outputUpdate,
                                                lidarprocessor.UPDATE)

    controls = lidarprocessor.Controls()
    progress = cuiprogress.GDALProgressBar()
    controls.setProgress(progress)
    controls.setWindowSize(WINDOWSIZE)
    controls.setSpatialProcessing(True)

    lidarprocessor.doProcessing(updatePointFunc, dataFiles, controls=controls)

    utils.compareLiDARFiles(os.path.join(oldpath, UPDATED_SPD),
                            outputUpdate,
                            windowSize=WINDOWSIZE)
Exemple #4
0
def run():
    """
    Main function. Checks the command line parameters and calls
    the rasterisation routine.
    """
    cmdargs = getCmdargs()

    rasterization.rasterize(cmdargs.infiles,
                            cmdargs.output,
                            cmdargs.attributes,
                            cmdargs.function,
                            cmdargs.type,
                            cmdargs.background,
                            cmdargs.binsize,
                            cmdargs.module,
                            cmdargs.quiet,
                            footprint=cmdargs.footprint,
                            windowSize=cmdargs.windowsize,
                            driverName=cmdargs.drivername,
                            driverOptions=cmdargs.driveroptions)
Exemple #5
0
def run(oldpath, newpath):
    """
    Runs the first basic test suite. Tests:

    Importing
    Creating spatial index
    creating a raster from 2 files at a different resolution
    """
    inputLas = os.path.join(oldpath, INPUT2_LAS)
    info = generic.getLidarFileInfo(inputLas)

    importedSPD = os.path.join(newpath, IMPORTED_SPD)
    translate(info,
              inputLas,
              importedSPD,
              epsg=28356,
              pulseIndex='FIRST_RETURN',
              buildPulses=True)
    utils.compareLiDARFiles(os.path.join(oldpath, IMPORTED_SPD), importedSPD)

    indexedSPD1 = os.path.join(oldpath, INDEXED_SPD_1)
    indexedSPD2 = os.path.join(newpath, INDEXED_SPD_2)
    createGridSpatialIndex(importedSPD,
                           indexedSPD2,
                           binSize=2.0,
                           tempDir=newpath)
    utils.compareLiDARFiles(os.path.join(oldpath, INDEXED_SPD_2), indexedSPD2)

    outputDEM = os.path.join(newpath, OUTPUT_DEM)
    rasterize([indexedSPD1, indexedSPD2],
              outputDEM, ['Z'],
              binSize=3.0,
              function="numpy.ma.min",
              atype='POINT',
              footprint=lidarprocessor.UNION)
    utils.compareImageFiles(os.path.join(oldpath, OUTPUT_DEM), outputDEM)