You are here: MrSID Decode SDK Command Line Tools > Decompressing MG4 Files

## Decompressing MG4 Files

The MrSID Decode SDK includes a command line tool called lidardecode. Located in the bin directory, lidardecode enables you to decompress MG4 files to LAS or text files.

###### Usage

The only required parameters are -inputFile (or -i), which specifies the input file name, and -outputFile (or -o), which specifies the output file name.

If no output format (-outputFormat or -of) is specified, the file extension specified in the -outputFile parameter is used as the output format.

If no output format (-outputFormat or -of) is specified and no file extension is specified in the output file name , then lidardecode decodes the file to the default format (text) and appends the default suffix (.txt) to the output file name.

You may add other options and parameters as described in the table of switches below. The order of the switches in the syntax has no bearing on the output.

For examples of how to form a command, see "Examples".

lidardecode Switches
-inputFile (-i) | string | (Required) Specifies name of input MG4 file.
-outputFile (-o) | string | (Required) Specifies name of output file. If no file extension is provided, default is to concatenate a format suffix to input file.
-outputFormat (-of) | string | Specifies output format. Acceptable values are TXT, LAS10, LAS11, LAS12. Default is TXT.
-subsample (-s) | unsigned integer | Tells lidardecode to subsample, taking every n-th point. -s 2 selects one half the file, -s 3 selects one third.
-crop (-c) | FLOAT0 FLOAT1 FLOAT2 FLOAT3 FLOAT4 FLOAT5 | Tells lidardecode to crop to the specified box (world coordinates: x-min, x-max, y-min, y-max, z-min, z-max). A value of -inf (for a minimum) or +inf (maximum) means do not crop in that direction.
-offset (-ofs) | FLOAT0 FLOAT1 FLOAT2 | Specifies the offset from which the points will be specified (world coordinates: x[0], y[0], z[0]. Default is to use the origin of the bounding box.
-outFields (-ofld) | string | Tells lidardecode to include particular fields. By default lidardecode outputs all those supported by the output format and are in the input file. x - x point values y - y point values z - z point values i - intensity r - return number n - number of returns d - scan direction e - edge of flight line a - scan angle c - class id p - source id u - user data t - GPS time R - red G - green B - blue
-scale (-sc) | FLOAT0 FLOAT1 FLOAT2 | Specifies the scale (or precision) factor (x-scale, y-scale, z-scale). Default is 0.001, 0.001, 0.001.
-h (-?) |  | Displays a short usage message.
-help |  | Displays a detailed usage message.
-version (-v) |  | Displays version information.
-verbose (-V) |  | Tells lidardecode to display more verbose error messages.
-credits |  | Displays credits and copyrights.

###### Examples

The following command uses the minimum required parameters and decodes to a text file called "Exp_D2_1.txt".

lidardecode -i E:\Data\localTestImages\Exp_D2_1.sid -o Exp_D2_1.txt

The following command produces the same result as the previous one, but because the user wants to change the output file name, the -o parameter has been included and the text output is explicitly called for.

lidardecode -i E:\Data\localTestImages\Exp_D2_1.sid -o E:\Data\localTestImages\Exp_D2_2.txt

The following command decodes to a LAS file.

lidardecode -i E:\Data\localTestImages\Exp_D2_1.sid -o E:\Data\localTestImages\Exp_D2_1.las

The following command decodes to a text file called "Exp_D2_1.xyz" (any extension other than .las results in a text file) and limits the data in the file to four fields (GPS time, x, y and z).

lidardecode -i E:\Data\localTestImages\Exp_D2_1.sid -o E:\Data\localTestImages\Exp_D2_1.xyz -ofld txyz