1

I am using python-pdal 2.4.2 to read a LAS 1.4 in PointFormat 8, with the objective or using different writers stages afterwards. The pipeline is simple:

import json
import pdal
filepath = "path/to/file.las"
pipeline = {"pipeline" : [{
        "type":"readers.las",
        "filename":filepath,
    }]}
pipeline = json.dumps(pipeline)
pipeline = pdal.Pipeline(pipeline)
count = pipeline.execute()

But I get the following error:

(readers.las Error) Global encoding WKT flag not set for point format 6 - 10.

Is this a format issue? According to the reader.las doc, pdal supports LAS 1.4. I have troubles understanding what this WKT (Well-Known Text) is about.

I read in the las specifications (see "COORDINATE REFERENCE SYSTEM (CRS) REPRESENTATION" section) that:

GeoTIFF is being replaced by Well Known Text (WKT) as the required Coordinate Reference System (CRS) representation for the new point types (6-10) introduced by LAS 1.4.

So I am guessing the CRS is missing in my LAS file (maybe it is still in GeoTIFF format ?).

I am looking for a way to either:

  • Make the pipeline work with the current las data that I have
  • Modify the las with LASPY (or another python package) in order to have afterwards a pipeline that starts with a PDAL reader.las.
  • Alternatively : read the LAS with laspy and then feed it (or the np.array) to pdal for subsequent operations.

Does anyone have a clue of what is going on? I am still discovering point cloud formats.

3
  • pdal does not support LAS files including waveform information (such as point type 9). Do you know if you are supposed to have FWF info ?
    – radouxju
    Oct 9, 2021 at 8:52
  • gis.stackexchange.com/users/350/howard-butler could have more information about that.
    – radouxju
    Oct 12, 2021 at 9:17
  • @radouxju I am not supposed to have any waveform information. Thanks for pinging a potential helper!
    – CharlesG
    Oct 12, 2021 at 12:30

2 Answers 2

1
+50

It appears that the LAS file was simply missing a Spatial Reference System. Based on the documentation for reader.las doc, I was able to skip the reading of a CRS, which removed the error using the nosrs parameter. I then used the override_srs parameter to set my own Spatial Reference System.

Code looks like this:

import json
pipeline = {"pipeline" : [{
        "type":"readers.las",
        "filename":filepath,
        "override_srs": "EPSG:2154",
        "nosrs": True
    }]}
pipeline = json.dumps(pipeline)
pipeline = pdal.Pipeline(pipeline)
count = pipeline.execute()```
1

I hope this provides a bit more context for the original question and helps anyone who comes here in the future:

For LAS 1.4 using Point Data Record Format 6 - 10, the Global Encoding (GE) flag must be set to "WKT", otherwise it will raise an error. See heading 2.2 Coordinate Reference System (CRS) Representation p. 6 in the ASPRS LAS Specification v1.4.

The flags are represented as bytes, so to set the WKT flag only, the GE value should be set to 16. However, the GPS Time of the Point Records should be formatted in Adjusted Standard GPS Time (ASPRS LAS Spec Table 4. p. 10), which is set using a GE value of 1. So the correct GE value of a LAS 1.4 file with PDRF 6 - 10 is 17 (16 + 1). This GeoCue page does a good job of summing up Global Encoding.

I recently had a similar issue to this question, some of my las files had the GE bit flag incorrectly set to 1 instead of 17 and readers.las threw the same runtime error. I opened an issue#116 on the python-pdal GitHub and turns out I was away overcomplicating it. The header can be edited simply by using open(). Andrew's solution below:

filename = "4_6.las"
f = open(filename, "rb+")
f.seek(6)
f.write(bytes([17, 0, 0, 0]));
f.close()

I hope this helps OP and anyone who might come looking.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.