Scroll to navigation

las2pg(1) las2pg(1)

NAME

las2pg - LAS translation to PostgreSQL binary format

SYNOPSIS


las2pg
[OPTIONS]

DESCRIPTION

las2pg performs LAS translation to PostgreSQL binary format with optional configuration.

OPTIONS

-h, -help, --help
produce help message
-v, --verbose
Verbose message output
--num_read_threads number
Set number of threads
-s, --skip_invalid
Skip writing invalid point(s)
-parse string, --parse string
Specify what exactly to write for each row (default is xyz). For example, 'txyzia' means that the first field of each row will be the gpstime, the next three fields will be the x, y, and z coordinates, the next field will be the intensity and the next field will be the scan angle. The supported entries are:

t - gpstime as double
x - x coordinate as double
y - y coordinate as double
z - z coordinate as double
a - scan angle as integer
i - intensity as integer
n - number of returns for given pulse as integer
r - number of this return as integer
c - classification number as integer
u - user data as integer
p - point source ID as integer
e - edge of flight line as integer
d - direction of scan flag as integer
R - red channel of RGB color as integer
G - green channel of RGB color as integer
B - blue channel of RGB color as integer
M - vertex index number as integer
k - Morton 2D code using X and Y (unscaled and no offset) as bigint

-moffset x,y, --moffset x,y
Specify a global offset in X and Y to be used when computing the Morton 2D code. Values must be unscaled
-check x,y, --check x,y
Check suitability to compute Morton 2D codes. It checks specified scale matches the one in input file. If --moffset is provided it also checks that obtained Morton 2D codes will be consistent, i.e. global X,Y within [0,2^31]
--stdout
Use STDOUT
-i arg, -in arg, -input arg, --input arg
file with the list las/laz files
-o arg, -out arg, --out arg, --output arg
output prefix

EXAMPLE

Convert a las/laz file into PostgreSQL binary dump format, outputs output_name:


las2pg -i input_file.las -o output_name
      

Use flag --stdout to write to standard output (recommended use together with a pipe, see below).

The intended use of this tool is by using the --stdout flag and a pipe to avoid storing intermediate files. Example:


las2pg 1.2-with-color.laz --parse xyzRGBi --stdout | psql -c "copy flat from stdin with binary"
      

This obviously require a table called flat to be created in a PostgreSQL DB beforehand. The table must have the columns in the same order as specified by the --parse option, and the column types must be the ones specified above. Example:


psql -c "create table flat (x double precision, y double precision, z double precision, r integer, g integer, b integer, i integer)"
      
16 February 2019