| 239 | } |
| 240 | |
| 241 | MetadataNode InfoKernel::run(const std::string& filename) |
| 242 | { |
| 243 | MetadataNode root; |
| 244 | std::unique_ptr<arbiter::LocalHandle> localHandle; |
| 245 | std::string readerDriver = m_driverOverride.size() |
| 246 | ? m_driverOverride : StageFactory::inferReaderDriver(filename); |
| 247 | |
| 248 | uint64_t pointCountOverride = 0; |
| 249 | |
| 250 | if (!m_needPoints && readerDriver == "readers.las" && Utils::isRemote(filename)) |
| 251 | { |
| 252 | auto pointless = getPointlessLasFile(filename); |
| 253 | pointCountOverride = pointless.pointCount; |
| 254 | localHandle = std::move(pointless.handle); |
| 255 | makeReader(localHandle->localPath()); |
| 256 | } |
| 257 | else |
| 258 | makeReader(filename); |
| 259 | |
| 260 | root.add("filename", filename); |
| 261 | root.add("pdal_version", Config::fullVersionString()); |
| 262 | |
| 263 | if (m_showSummary) |
| 264 | { |
| 265 | QuickInfo qi = m_manager.getStage()->preview(); |
| 266 | if (!qi.valid()) |
| 267 | throw pdal_error("No summary data available for '" + |
| 268 | filename + "'."); |
| 269 | |
| 270 | // Correct our point count with the actual value. |
| 271 | if (pointCountOverride) |
| 272 | { |
| 273 | m_reader->getMetadata().addOrUpdate("count", pointCountOverride); |
| 274 | qi.m_pointCount = pointCountOverride; |
| 275 | } |
| 276 | root.add(qi.dumpSummary().clone("summary")); |
| 277 | } |
| 278 | else |
| 279 | { |
| 280 | makePipeline(); |
| 281 | if (m_needPoints || m_showMetadata) |
| 282 | m_manager.execute(ExecMode::PreferStream); |
| 283 | else |
| 284 | m_manager.prepare(); |
| 285 | |
| 286 | // Correct our point count with the actual value. |
| 287 | if (pointCountOverride) |
| 288 | m_reader->getMetadata().addOrUpdate("count", pointCountOverride); |
| 289 | |
| 290 | dump(root); |
| 291 | } |
| 292 | |
| 293 | std::time_t now |
| 294 | = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); |
| 295 | std::stringstream t; |
| 296 | t << std::put_time( std::localtime( &now ), "%FT%T%z" ); |
| 297 | root.add("reader", m_reader->getName()); |
| 298 | root.add("now", t.str()); |
nothing calls this directly
no test coverage detected