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():
    """
    Main function. Looks at the command line arguments and calls
    the indexing code.
    """
    cmdargs = getCmdargs()

    if cmdargs.extent is not None:
        extent = Extent(float(cmdargs.extent[0]), float(cmdargs.extent[2]), 
            float(cmdargs.extent[1]), float(cmdargs.extent[3]), 
            cmdargs.resolution)
    else:
        extent = None

    try:
        indexType = getattr(spdv4, "SPDV4_INDEX_%s" % cmdargs.indextype)
    except AttributeError:
        msg = 'Unsupported index type %s' % cmdargs.indextype
        raise generic.LiDARPulseIndexUnsupported(msg)            

    try:
        pulseindexmethod = getattr(spdv4, 
                    "SPDV4_PULSE_INDEX_%s" % cmdargs.pulseindexmethod)
    except AttributeError:
        msg = 'Unsupported pulse indexing method %s' % cmdargs.pulseindexmethod
        raise generic.LiDARPulseIndexUnsupported(msg)            

    gridindex.createGridSpatialIndex(cmdargs.input, cmdargs.output, 
                                extent=extent, tempDir=cmdargs.tempdir,
                                indexType=indexType,
                                pulseIndexMethod=pulseindexmethod,
                                binSize=cmdargs.resolution,
                                blockSize=cmdargs.blocksize,
                                wkt=cmdargs.wkt) 
Exemple #3
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 #4
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 #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)