Skip to content

Instantly share code, notes, and snippets.

@sunapi386
Created April 2, 2019 05:49
Show Gist options
  • Select an option

  • Save sunapi386/9971ce1152c20ad65b3e54931dbb58b5 to your computer and use it in GitHub Desktop.

Select an option

Save sunapi386/9971ce1152c20ad65b3e54931dbb58b5 to your computer and use it in GitHub Desktop.
C++ LAZ-PERF LAZPERF LAS tool example how to use
#include <laz-perf/io.hpp>
#include <laz-perf/las.hpp>
#include <filesystem>
void write_a_fake_laz(const std::string &path) {
const std::filesystem::path &outname (path);
using namespace laszip;
using namespace laszip::formats;
struct point {
las::point10 p;
};
io::header header{};
io::writer::config config(header);
factory::record_schema schema;
schema(factory::record_item::point());
io::writer::file f(outname.string(), schema, config);
point p;
std::cout << "write laz " << outname << "\n";
for (int i =0; i<70000; i++) {
p.p.x = int(i * 10.0);
p.p.y = int(i * 100.0);
p.p.z = int(i * 1000.0);
f.writePoint((char *)&p);
}
f.close();
}
@sennj
Copy link

sennj commented Oct 30, 2025

Hi @sunapi386, thank you very much for the example, but it seems outdated... Would it be possible to have an updated version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment