How to tweak this project to your data usage - Remi-C/Pointcloud_in_db GitHub Wiki
##How to tweak to your perticular use case##
Working with your own point attributes
@TODO To load and use your own point type (meaning a lidar point with any attributes) you need to tweak several parts
- scripts :
1_Preparing_DB_before_load.sql
- Add an entry to the
pointcloud_formats
table with your own data schema - Create a patch table using right patch definition (PCPATCH(N), where N is the pcid of your schema)
- Add an entry to the
parallel_import_into_db.sh
- Change at least the data folder to match the data where your data is
- change the
pointschema
to your custom schema
sequential_import_into_db.sh
- Change the definition of temporary table (sql CREATE TABLE), the columns must match exactly you point attributes
- Change the way the patches are created, as there is a hardcoded list of attributes here, and the pcid is also hardcoded
3_tuning_table_after_load.sql
- You may want custom indexes about some of your attributes.
Loading from other file type than binary ply
The solution can be easily adapted to work with point data other than binary ply.
Supposing that you have a programm converting you point into a stream of ascii values,
you just have to echange the parameter programmplytoascii
in the parallel_import_into_db.sh
to give your programm.
This project assume you have several points files so to be able to load theim in parallel. If you have one big file you can use the man split
commande to split it into several files.
If you want to change more deeply the way data is loaded you need to edit the script one_file_import_into_db.sh
. This way you can for example load binary data with pg_bulkload
TIP : if you point are already in csv format, you can use a linux command to stream it to the psql COPY process (like cat
or sed
).
If you use the .las format, there is a las2txt utility, you will need to remove the header
You could also use the PDAL project, alltought still in alpha release
Using different kind of partitions for your patches
The demo use a partition by cubic meter
Here are some tips to use other
*
* partition by 0.50.50.5 cubic meter
GROUP BY 0.5*ROUND(2*ST_X(point::geometry)),0.5*ROUND(2*ST_Y(point::geometry)),0.5*ROUND(2*ST_Z(point::geometry))
>Or
* GROUP BY 0.5*ROUND(2*PC_Get(point,'x')),0.5*ROUND(2*PC_Get(point,'y')),0.5*ROUND(2*PC_Get(point,'z'))
* partition using an irregular grid (Postgis)
* GROUP BY ST_SnapToGrid(point::geometry,5,4)
* partition by 100 Millisecond on acquisition time
* GROUP BY ROUND(1000*PC_Get(point,'gps_time')/100)
* multi scale partition :
- first partition by cubic meter, then partition by 555 cubic meter the patches containing less than 5 points