3

I need to recieve the number of points that .las file has from Python and save it as variable. For now I'm doing it like this:

def execute(self, pipeline):
    pipeline = pdal.Pipeline(json.dumps(pipeline))
    pipeline.validate()
    self.points_num += int(pipeline.execute())

def points(self, file):
    pipeline = [
        file,
        {
            "type": "filters.info",
        }
    ]
    self.execute(pipeline)

However when file is big (above 2Gb) the procedure takes up to 4 minutes. Is there a smarter way to get number of points?

4
  • Have you tried using the laspy package? Then you can read your LAS file, and then get the number of points with len(your_las_file.read().points)
    – Taras
    Commented Aug 19, 2021 at 7:28
  • 1
    Yeah, thanks, but I wnat to limit the number of libraries to be used Commented Aug 19, 2021 at 7:40
  • 1
    Here it is shown that you may use the -info, and after that you can len(dict.items()).
    – Taras
    Commented Aug 19, 2021 at 7:52
  • 1
    Did you get a solution to your problem? Commented Jul 21, 2022 at 17:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.