// Build the list of dimensions for the output schema. // Placing this here allows validation of dimensions before execution begins. void DbWriter::prepared(PointTableRef table) { using namespace Dimension; PointLayoutPtr layout = table.layout(); if (m_outputDims.empty()) { for (auto& dimType : layout->dimTypes()) m_dbDims.push_back(XMLDim(dimType, layout->dimName(dimType.m_id))); return; } DimTypeList dims; for (std::string& s : m_outputDims) { DimType dt = layout->findDimType(s); if (dt.m_id == Id::Unknown) { std::ostringstream oss; oss << "Invalid dimension '" << s << "' specified for " "'output_dims' option."; throw pdal_error(oss.str()); } m_dbDims.push_back(XMLDim(dt, layout->dimName(dt.m_id))); } }
DimTypeList DbWriter::dimTypes(PointTableRef table) { using namespace Dimension; PointLayoutPtr layout = table.layout(); if (m_outputDims.empty()) return layout->dimTypes(); DimTypeList dims; for (std::string& s : m_outputDims) { DimType dt = layout->findDimType(s); if (dt.m_id == Id::Unknown) { std::ostringstream oss; oss << "Invalid dimension '" << s << "' specified for " "'output_dims' option."; throw pdal_error(oss.str()); } dims.push_back(dt); } return dims; }