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

Method handleOriginQuery

io/EptReader.cpp:332–457  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330
331
332void EptReader::handleOriginQuery()
333{
334 const std::string search(m_args->m_origin);
335
336 if (search.empty())
337 return;
338
339 log()->get(LogLevel::Debug) << "Searching sources for " << search <<
340 std::endl;
341
342
343 // In the initial EPT version 1.0.0, a source-file summary was stored in
344 // "list.json", with detailed metadata for each file being stored together
345 // in chunks. So, the list.json array entries contained both a URL (to the
346 // proper chunk) and an ID (for the key into that chunk object) in order to
347 // look up the detailed metadata for an entry.
348 //
349 // In version 1.1.0, this chunking indirection was removed, with each
350 // summary entry containing a "metadataPath" key pointing to detailed
351 // metadata for a single source file only. This summary file is called
352 // "manifest.json", so the older version can coexist with the new version
353 // non-destructively.
354 //
355 // At the moment, we only care about the summary information, which contains
356 // both the original file path and the bounds, and in each of these summary
357 // formats, those specific entries are exactly the same. So we just need to
358 // grab either file and can use the same logic thereafter. Prefer manifest,
359 // if it exists, since it's the newer one.
360
361 NL::json sources;
362 try
363 {
364 sources = m_p->connector->getJson(
365 m_p->info->sourcesDir() + "manifest.json");
366 }
367 catch (...) {}
368
369 if (sources.is_null())
370 {
371 try
372 {
373 sources = m_p->connector->getJson(
374 m_p->info->sourcesDir() + "list.json");
375 }
376 catch (...) {}
377 }
378
379 if (sources.is_null())
380 {
381 throwError("Failed to fetch input sources metadata");
382 }
383
384 log()->get(LogLevel::Debug) << "Fetched sources list" << std::endl;
385
386 if (!sources.is_array())
387 {
388 throwError("Unexpected sources list: " + sources.dump());
389 }

Callers

nothing calls this directly

Calls 13

toBox3dFunction · 0.85
getJsonMethod · 0.80
sourcesDirMethod · 0.80
atMethod · 0.80
logFunction · 0.50
emptyMethod · 0.45
getMethod · 0.45
dumpMethod · 0.45
sizeMethod · 0.45
findMethod · 0.45
growMethod · 0.45
validMethod · 0.45

Tested by

no test coverage detected