Skip to content

Instantly share code, notes, and snippets.

@connormanning
Created October 25, 2015 04:37
Show Gist options
  • Save connormanning/4fba0533dcb7df9af5f4 to your computer and use it in GitHub Desktop.
Save connormanning/4fba0533dcb7df9af5f4 to your computer and use it in GitHub Desktop.
Missing dimensions from QuickInfo
#include <pdal/Reader.hpp>
#include <pdal/StageFactory.hpp>
namespace
{
const std::string path("autzen.las");
}
int main()
{
pdal::StageFactory factory;
const std::string driver(factory.inferReaderDriver(path));
if (driver.empty()) throw std::runtime_error("No driver - " + path);
std::unique_ptr<pdal::Reader> reader(
static_cast<pdal::Reader*>(factory.createStage(driver)));
if (!reader) throw std::runtime_error("No reader - " + path);
pdal::Options options;
options.add(pdal::Option("filename", path));
reader->setOptions(options);
const pdal::QuickInfo quick(reader->preview());
if (!quick.valid()) throw std::runtime_error("No preview - " + path);
for (const std::string& name : quick.m_dimNames)
{
std::cout << "\t" << name << std::endl;
}
return 0;
}
~/code/test/infer $ g++ -std=c++11 -lpdalcpp missing.cpp && ./a.out
X
Y
Z
Intensity
ReturnNumber
NumberOfReturns
ScanDirectionFlag
EdgeOfFlightLine
Classification
ScanAngleRank
UserData
PointSourceId
~/code/test/infer $ pdal info autzen.las
{
"filename": "autzen.las",
"pdal_version": "1.0.1 (git-version: 70d501)",
"stats":
{
"statistic":
[
{
"average": 637294.2069,
"count": 10653,
"maximum": 638994.75,
"minimum": 635589.01,
"name": "X",
"position": 0
},
{
"average": 851251.3223,
"count": 10653,
"maximum": 853535.43,
"minimum": 848886.45,
"name": "Y",
"position": 1
},
{
"average": 434.3918032,
"count": 10653,
"maximum": 593.73,
"minimum": 406.59,
"name": "Z",
"position": 2
},
{
"average": 76.97136957,
"count": 10653,
"maximum": 254,
"minimum": 0,
"name": "Intensity",
"position": 3
},
{
"average": 1.182671548,
"count": 10653,
"maximum": 4,
"minimum": 1,
"name": "ReturnNumber",
"position": 4
},
{
"average": 1.368910166,
"count": 10653,
"maximum": 4,
"minimum": 1,
"name": "NumberOfReturns",
"position": 5
},
{
"average": 0.5070872055,
"count": 10653,
"maximum": 1,
"minimum": 0,
"name": "ScanDirectionFlag",
"position": 6
},
{
"average": 0,
"count": 10653,
"maximum": 0,
"minimum": 0,
"name": "EdgeOfFlightLine",
"position": 7
},
{
"average": 1.255233268,
"count": 10653,
"maximum": 2,
"minimum": 1,
"name": "Classification",
"position": 8
},
{
"average": -0.8267154792,
"count": 10653,
"maximum": 19,
"minimum": -20,
"name": "ScanAngleRank",
"position": 9
},
{
"average": 126.4355581,
"count": 10653,
"maximum": 156,
"minimum": 117,
"name": "UserData",
"position": 10
},
{
"average": 7329.903877,
"count": 10653,
"maximum": 7334,
"minimum": 7326,
"name": "PointSourceId",
"position": 11
},
{
"average": 120.9694922,
"count": 10653,
"maximum": 252,
"minimum": 39,
"name": "Red",
"position": 12
},
{
"average": 125.8803154,
"count": 10653,
"maximum": 254,
"minimum": 56,
"name": "Green",
"position": 13
},
{
"average": 110.8436121,
"count": 10653,
"maximum": 251,
"minimum": 56,
"name": "Blue",
"position": 14
},
{
"average": 247608.4878,
"count": 10653,
"maximum": 249783.5881,
"minimum": 245369.9758,
"name": "GpsTime",
"position": 15
}
]
}
}
~/code/test/infer $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment