MCPcopy Create free account
hub / github.com/PDAL/PDAL / getPointlessLasFile

Function getPointlessLasFile

kernels/private/PointlessLas.cpp:60–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58} // namespace
59
60PointlessLas getPointlessLasFile(const std::string& path)
61{
62 assert(Utils::isRemote(path));
63
64 const uint64_t maxHeaderSize(375);
65
66 const uint64_t minorVersionPos(25);
67 const uint64_t headerSizePos(94);
68 const uint64_t pointOffsetPos(96);
69 const uint64_t legacyPointCountPos(107);
70 const uint64_t evlrOffsetPos(235);
71 const uint64_t evlrNumberPos(evlrOffsetPos + 8);
72 const uint64_t pointCountPos(247);
73
74 std::string fileSignature;
75 uint8_t minorVersion(0);
76 uint16_t headerSize(0);
77 uint32_t pointOffset(0);
78 uint64_t evlrOffset(0);
79 uint32_t evlrNumber(0);
80 uint32_t legacyPointCount(0);
81 uint64_t pointCount(0);
82
83 arbiter::Arbiter a;
84
85 std::string header(a.get(path, getRangeHeader(0, maxHeaderSize)));
86
87 std::stringstream headerStream(
88 header,
89 std::ios_base::in | std::ios_base::out | std::ios_base::binary);
90
91 pdal::ILeStream is(&headerStream);
92 pdal::OLeStream os(&headerStream);
93
94 is.seek(0);
95 is.get(fileSignature, 4);
96
97 if (fileSignature != "LASF")
98 {
99 throw std::runtime_error(
100 "Invalid file signature for .las or .laz file: must be LASF");
101 }
102
103 is.seek(minorVersionPos);
104 is >> minorVersion;
105
106 is.seek(headerSizePos);
107 is >> headerSize;
108
109 is.seek(pointOffsetPos);
110 is >> pointOffset;
111
112 is.seek(legacyPointCountPos);
113 is >> legacyPointCount;
114 pointCount = legacyPointCount;
115
116 // Set the legacy point count to 0 since we are removing the point data.
117 os.seek(legacyPointCountPos);

Callers 1

runMethod · 0.85

Calls 13

isRemoteFunction · 0.85
getRangeHeaderFunction · 0.85
joinFunction · 0.85
strMethod · 0.80
getBinaryMethod · 0.80
getMethod · 0.45
seekMethod · 0.45
dataMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected