- See also
- opals::IInfo
Aim of module
Extracts and reports header information of a vector or raster file (ODM, GDAL).
General description
opalsInfo extracts statistic information (number of points/lines/polygons, the bounding box, attribute information, spatial index details, etc..) from a data set input file. Currently, only ODMs are supported. However, the support of vector files, grid and tin file formats is planned for the future. In general, all information provided in the header of the file format is made available through a generic file statistics object.
- See also
- Module Info
Parameter description
-inFileinput file
Type:
opals::Path
Remarks: mandatory
Currently ODMs, LAS/LAZ and grid can be specified as input file. More data formats may be supported in the future.
-exactComputationexact computation mode
Type: bool
Remarks: default=0
In exact mode the information is extracted/computed from the file content rather than from the file header. For certain formats (e.g. LAS/LAZ) more information can be presented, if the extact mode is activated.
-valueFrequencyextract value frequencies for defined attributes/bands
Type:
opals::Vector<
opals::String>
Remarks: optional
For the specified attribute/bands value frequencies will be extracted. This options implicitly activates the exact computation mode.
-statisticfile statistics
Type:
opals::DataSetStats
Remarks: output
The result of the file statistic extraction provided as generic object. Specify -outParamFile in order to store these results to an XML file.
-exportOverviewexport header features
Type:
opals::Vector<
opals::HeaderFeature>
Remarks: optional
Possible values:
all .............. all possible header feature
overviewZ ........ Z-Matrix overview
overviewPcount ... Pcount-Matrix overview
Exports internally stored header information to files. This parameter is currently supported with ODMs file only.
-multiBandExport overview as multi-band raster
Type: bool
Remarks: default=0
When activated and exporting mulitple header feature a single overview file with multiple bands will be created.
Examples
The data used in the following example are located in the $OPALS_ROOT/demo/
directory. The example shows how to use opalsInfo to get an overview about data (including their attributes) within an odm.
Example 1:
As a prerequisite, the ALS point cloud data must be imported into the ODM. To achieve that, change to the demo
directory and type:
Now, run the following command
which gives the following output:
[...]
14:24:23:
Statistic Value
Filename D:\opals\demo\fullwave.odm
Point density 3.75
SpatialReference
---
Minimum 24820.000 311160.006 275.535
Maximum 25000.000 311260.000 328.500
[...]
After a generic information block the section about the data set attributes is listed. Figure 1 captures the corresponding section from the log file.
Fig. 1: Attribute statistics of demo data set fullwave
.fwf
A special feature of the ODM is the on-the-fly collection of statistical information of all attributes. A useful feature for checking the correctness of imported or processed data. The last five attributes (Id, FileId, LayerId, WinputCode and StructNr) are "virtual" attributes. They exist for internally reason, however, are not made persistent on disk.
With the following command
opalsNormals -infile fullwave.odm -neighbours 8 -searchRadius 1
local planes are estimated within each point of the data set. In the current example the computation succeeds for 67297 points (and fails in 116 cases). Running opalsInfo again
will show the newly added attributes (c.f. Figure 2). The statistics also reflect the number of successful computated plane estimations (For NormalSigma0
even less values have been set, since redundancy is required for its computation).
Fig. 2: Attribute statistics after normals estimation
The last section of the module output covers information of the spatial index (c.f. Figure 3). The spatial index statistics is also reported after importing a data set, since it is crucial for processing the ODM. For further details please refer to section Analysing the index statistics of an ODM.
Fig. 3: Spatial index information
Example 2:
When running Module Info within a Python script, direct access to the statistics of the dataset is provided via the OPALS Python API. This is exemplified in the sample script $OPALS_ROOT/demo/infoDemo.py
:
2 from opals
import Import
7 logLevel=opals.Types.LogLevel.none
11 imp = Import.Import(inFile=[
"strip11.laz"], tileSize=5, screenLogLevel=logLevel)
16 inf = Info.Info(inFile=imp.outFile, screenLogLevel=logLevel)
18 att_stat = inf.statistic.getAttributes()
19 idx_stat = inf.statistic.getIndices ()
23 print(
"Attribute statistics of file {}".format(imp.outFile) )
24 print(
"Name: Count/Min/Mean/Max")
26 print(
"Name {}: {:0d}/{:0.3f}/{:0.3f}/{:0.3f}".format( a.getName(), a.getCount(), \
27 a.getMin(), a.getMean(), a.getMax()))
28 print(
"-----------------------------------------------------------")
32 print(
"Spatial index statistics of file {}".format(imp.outFile) )
34 print(
"{:0d} leaves".format( i.getCountLeaf()))
35 print(
"Tile size: {:0.1f}".format(i.getTileSize()))
36 print(
"Min #pts per leaf: {:0.1f}".format(i.getObjectsInLeafMin()))
37 print(
"Mean #pts per leaf: {:0.1f}".format(i.getObjectsInLeafMean()))
38 print(
"Max #pts per leaf: {:0.1f}".format(i.getObjectsInLeafMax()))
To run the script, type:
The script imports the dataset strip11.laz
and queries the attribute and spatial index statistics. This is achieved by accessing the statistic parameter provided by Module Info. The script uses the access function of the complex Python type opals::DataSetStats to query (and print) the respective values.
Attribute statistics of file strip11.odm
Name ScanDirection: 378712/0.000/0.000
Name EdgeOfFlightLine: 378712/0.000/0.000
Name UserData: 378712/0.000/0.000
Name PointSourceId: 378712/11.000/11.000
Name GPSTime: 378712/37983.419/37986.177
Name _PulseWidth: 378712/1.700/4.837
Name Id: 378712/2147483648.000/4729435047628892.000
Name FileId: 378712/1.000/1.000
Name LayerId: 378712/0.000/0.000
Name WinputCode: 378712/30.000/30.000
Name StructNr: 378712/0.000/0.000
-----------------------------------------------------------
Spatial index statistics of file strip11.odm
2090 leaves
Tile size: 5.0
Min #pts per leaf: 1.0
Mean #pts per leaf: 181.2
Max #pts per leaf: 530.0
Example 3: Value frequencies
Beside the standard statistic measures like min, max, mean and standard deviation, the module also supports the determination of value frequencies of specified attributes. This is feature can be used e.g. to retrieve all classification values that exist within a dataset. The following command
outputs (after the standard attribute table) a value frequency table for the specified attributes:
...
PointSourceId
uint16 378712 --- 11 11 11.000 0.000
GPSTime double 378712 --- 37983.419 37988.897 37986.177 1.120
_PulseWidth double 378712 --- 1.700 31.500 4.837 0.653
12:22:52:
Value Frequencies
Name Value Absolute Frequency Relative Frequency [%]
0 205137 54.17
2 173575 45.83
Nodata values (or attributes that are marked as invalid) are printed in the first row and therefore also visible within the table. The value frequency is not limited to integer attributes, but the computation is currently restricted to 1000 unique values. If more than 1000 values exists, the frequency histogram is not further extended.
- Author
- jo, gm
- Date
- 23.10.2018