[pgpointcloud] Troubles inserting .las data into pgpointcloud

Gabriel gabriel at autistici.org
Fri Feb 23 09:11:37 PST 2018


Hello everyone.
I'm trying to upload italian lidar data into a pgpointcloud database.

These data are available in esri ascii format, and i managed to read 
them succesfully using the gdal reader provided with pdal.
The schema of the data is the following:

"pdal_version": "1.6.0 (git-version: Release)",
   "schema":
   {
     "dimensions":
     [
       {
         "name": "X",
         "size": 8,
         "type": "floating"
       },
       {
         "name": "Y",
         "size": 8,
         "type": "floating"
       },
       {
         "name": "band-1",
         "size": 8,
         "type": "floating"
       }
     ]
   }

I wrote an xml schema and I inserted it into the pointcloud_formats 
table using this query:

INSERT INTO pointcloud_formats (pcid, srid, schema) VALUES (1, 4326,
'<?xml version="1.0" encoding="UTF-8"?>
<pc:PointCloudSchema xmlns:pc="http://pointcloud.org/schemas/PC/1.1"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <pc:dimension>
     <pc:position>1</pc:position>
     <pc:size>8</pc:size>
     <pc:name>X</pc:name>
     <pc:interpretation>float</pc:interpretation>
   </pc:dimension>
   <pc:dimension>
     <pc:position>2</pc:position>
     <pc:size>8</pc:size>
     <pc:name>Y</pc:name>
     <pc:interpretation>float</pc:interpretation>
   </pc:dimension>
   <pc:dimension>
     <pc:position>3</pc:position>
     <pc:size>8</pc:size>
     <pc:name>Z</pc:name>
     <pc:interpretation>float</pc:interpretation>
   </pc:dimension>
</pc:PointCloudSchema>');


Then I wrote this pipeline to process the lidar data and push them into 
the DB:

{
	"pipeline":[
		{
			"type" : "readers.gdal",
			"filename" : "21k32_2x2_dsm_002_2008_3003.asc"
		},
		{
			"type":"filters.reprojection",
			"in_srs":"EPSG:3003",
			"out_srs":"EPSG:4326"
		},
		{
			"type" : "filters.ferry",
			"dimensions": "band-1=Z"
		},
		{
			"type": "writers.pgpointcloud",
			"connection":"host='localhost' dbname='postgres' user='postgres' 
password='secret'",
			"table" : "points",
			"column": "pt",
			"pcid": "1",
			"output_dims": "X,Y,Z"
		}
	]
}

Unfortunately the db returns me this error:
      PDAL: ERRORE:  pc_point_from_wkb: wkb size inconsistent with schema 
size
      LINE 1: INSERT INTO "points" ("pt") VALUES 
('010100000000000000f0c10...

I tried to remove any pointcloud schema and let PDAL generate it's own, 
i tried changin the size, the interpretation, but I always receive the 
same error.
However, if i convert the data into text and try to insert manually 
using the query:
     INSERT INTO points (pt)
     SELECT PC_MakePoint(1, ARRAY[11.167,43.797,38.13]);

The query succeed.
The postgres version is 9.6 and I'm running on Debian 10.
Am I doing something wrong? Is my db bugged?

Thanks, Gabriel



More information about the pgpointcloud mailing list