Indexing

indexing module. A algorithms for creating spatial indexed data

Grid Indexing

Deals with creating a grid spatial index

pylidar.toolbox.indexing.gridindex.BLOCKSIZE_N_BLOCKS = 2

Types of spatial indices. Copied from spdv4.

pylidar.toolbox.indexing.gridindex.INDEX_SCAN = 5

Types of pulse indexing methods. Copied from spdv4.

pylidar.toolbox.indexing.gridindex.classifyFunc(data, otherArgs)[source]

Called by lidarprocessor. Looks at the input data and splits into the appropriate output files.

pylidar.toolbox.indexing.gridindex.copyScaling(input, output)[source]

Copy the known scaling required fields accross.

Internal method. Called from classifyFunc.

pylidar.toolbox.indexing.gridindex.createGridSpatialIndex(infile, outfile, binSize=1.0, blockSize=None, tempDir=None, extent=None, indexType=1, pulseIndexMethod=0, wkt=None)[source]

Creates a grid spatially indexed file from a non spatial input file. Currently only supports creation of a SPD V4 file.

Creates a tempfile for every block (using blockSize) and them merges them into the output building a spatial index as it goes. If blockSize isn’t set then it is picked using BLOCKSIZE_N_BLOCKS. binSize is the size of the bins to create the spatial index. if tempDir is none a temporary directory will be created with tempfile.mkdtemp and removed at the end of processing. extent is an Extent object specifying the extent to work within. indexType is one of the INDEX_* constants. pulseIndexMethod is one of the PULSE_INDEX_* constants. wkt is the projection to use for the output. Copied from the input if not supplied. nPulsesPerChunkMerge is the number of pulses to process at a time when merging.

pylidar.toolbox.indexing.gridindex.getDefaultWKT()[source]

When processing data in sensor or project coordinates we may not have a WKT. However, rios.pixelgrid requires something. For now return the WKT for GDA96/MGA zone 55 until we think of something better.

pylidar.toolbox.indexing.gridindex.indexAndMerge(extentList, extent, wkt, outfile, header)[source]

Internal method to merge all the temporary files into the output spatially indexing as we go.

pylidar.toolbox.indexing.gridindex.indexPulses(pulses, points, pulseIndexMethod)[source]

Internal method to assign a point coordinates to the X_IDX and Y_IDX columns based on the user specified pulse_index_method.

pylidar.toolbox.indexing.gridindex.setScalingForCoordField(driver, srcfield, coordfield)[source]

Internal method to set the output scaling for range of data.

pylidar.toolbox.indexing.gridindex.splitFileIntoTiles(infiles, binSize=1.0, blockSize=None, tempDir='.', extent=None, indexType=1, pulseIndexMethod=0, footprint=<Mock name='mock.imageio.UNION' id='139837271977872'>, outputFormat='SPDV4', buildPulses=False)[source]

Takes a filename (or list of filenames) and creates a tempfile for every block (using blockSize). If blockSize isn’t set then it is picked using BLOCKSIZE_N_BLOCKS. binSize is the size of the bins to create the spatial index. indexType is one of the INDEX_* constants. pulseIndexMethod is one of the PULSE_INDEX_* constants. footprint is one of lidarprocessor.UNION or lidarprocessor.INTERSECTION and is how to combine extents if there is more than one file. outputFormat is either ‘SPDV4’ or ‘LAS’. ‘LAS’ outputs only supported when input is ‘LAS’. buildPulses relevant for ‘LAS’ and determines whether to build the pulse structure or not.

returns the header of the first input file, the extent used and a list of (fname, extent) tuples that contain the information for each tempfile.