PDAL / PDAL

PDAL is Point Data Abstraction Library. GDAL for point cloud data.

Home Page:https://pdal.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tiledb writer does not handle scale parameters correctly

weidinger-c opened this issue · comments

I want to use the tiledb writer to read in las files into tiledb.
Unfortunately, the default value for the scale is 0.01, which means only centimeter accuary of point positions. I need at least millimeter accuracy, which would mean scale parameters of 0.001.

But when I set the scale params, the coordinate values are overflowing, so there must be a bug inside the module.

Call with 0.01:

# If the array already exists, append, otherwise create it
    pipeline = pdal.Reader.las(
        filename=str(pointcloud_filepath), use_eb_vlr=True
    ).pipeline()
    if tiledb.object_type(tiledb_array_name) == "array":
        pipeline |= pdal.Writer.tiledb(filename=tiledb_array_name, append=True)
    else:
        pipeline |= pdal.Writer.tiledb(
            filename=tiledb_array_name,
            allow_dups=False,
            filter_profile="balanced",
            scale_x=0.01,
            scale_y=0.01,
            scale_z=0.01,
        )
    pipeline.execute()

Result:

A_read = tiledb.open(tiledb_array_name, "r")
print(A_read.df[:])

X Y Z Intensity Classification Synthetic KeyPoint Withheld Overlap ScanAngleRank UserData PointSourceId Red Green Blue Label PointId BitFields
0 4514810.67 5428910.93 330.05 21324 0 0 0 0 0 0.0 0 0 23130 23644 24415 65 492250 4352
1 4514809.95 5428911.59 330.05 20804 0 0 0 0 0 0.0 0 0 24672 21588 23130 65 532661 4352
2 4514810.03 5428911.53 330.05 22365 0 0 0 0 0 0.0 0 0 22616 21074 19789 65 428614 4352
3 4514810.07 5428911.54 330.06 22365 0 0 0 0 0 0.0 0 0 37008 35980 34695 65 880808 4352
4 4514810.72 5428910.95 330.06 21844 0 0 0 0 0 0.0 0 0 29812 24929 9509 65 904188 4352
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
925979 4514822.18 5428917.70 337.18 20804 0 0 0 0 0 0.0 0 0 43947 51657 62194 65 30871 4352
925980 4514822.46 5428917.81 337.18 15603 0 0 0 0 0 0.0 0 0 40092 47802 57568 65 209132 4352
925981 4514822.48 5428917.73 337.18 16643 0 0 0 0 0 0.0 0 0 43947 51143 61166 65 64867 4352
925982 4514823.40 5428915.18 337.21 15603 0 0 0 0 0 0.0 0 0 41891 51914 63736 65 153357 4352
925983 4514822.27 5428917.87 337.24 16123 0 0 0 0 0 0.0 0 0 42405 51657 62451 65 258397 4352

Call with 0.001:

# If the array already exists, append, otherwise create it
    pipeline = pdal.Reader.las(
        filename=str(pointcloud_filepath), use_eb_vlr=True
    ).pipeline()
    if tiledb.object_type(tiledb_array_name) == "array":
        pipeline |= pdal.Writer.tiledb(filename=tiledb_array_name, append=True)
    else:
        pipeline |= pdal.Writer.tiledb(
            filename=tiledb_array_name,
            allow_dups=False,
            filter_profile="balanced",
            scale_x=0.001,
            scale_y=0.001,
            scale_z=0.001,
        )
    pipeline.execute()

Result:
X Y Z Intensity Classification Synthetic KeyPoint Withheld Overlap ScanAngleRank UserData PointSourceId Red Green Blue Label PointId BitFields
0 -2147483.648 -2147483.648 330.046 21324 0 0 0 0 0 0.0 0 0 23130 23644 24415 65 492250 4352
1 -2147483.648 -2147483.648 330.053 20804 0 0 0 0 0 0.0 0 0 24672 21588 23130 65 532661 4352
2 -2147483.648 -2147483.648 330.054 22365 0 0 0 0 0 0.0 0 0 22616 21074 19789 65 428614 4352
3 -2147483.648 -2147483.648 330.056 22365 0 0 0 0 0 0.0 0 0 37008 35980 34695 65 880808 4352
4 -2147483.648 -2147483.648 330.057 21844 0 0 0 0 0 0.0 0 0 29812 24929 9509 65 904188 4352
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
925979 -2147483.648 -2147483.648 337.179 20804 0 0 0 0 0 0.0 0 0 43947 51657 62194 65 30871 4352
925980 -2147483.648 -2147483.648 337.181 15603 0 0 0 0 0 0.0 0 0 40092 47802 57568 65 209132 4352
925981 -2147483.648 -2147483.648 337.181 16643 0 0 0 0 0 0.0 0 0 43947 51143 61166 65 64867 4352
925982 -2147483.648 -2147483.648 337.208 15603 0 0 0 0 0 0.0 0 0 41891 51914 63736 65 153357 4352
925983 -2147483.648 -2147483.648 337.240 16123 0 0 0 0 0 0.0 0 0 42405 51657 62451 65 258397 4352