| 580 | } |
| 581 | |
| 582 | void TileDBWriter::done(PointTableRef table) |
| 583 | { |
| 584 | for (auto& dimBuffer : m_buffers) |
| 585 | { |
| 586 | dimBuffer->resizeBuffer(m_current_idx); |
| 587 | } |
| 588 | if (flushCache()) |
| 589 | { |
| 590 | if (!m_args->m_append) |
| 591 | { |
| 592 | if (!getSpatialReference().empty() && |
| 593 | table.spatialReferenceUnique()) |
| 594 | { |
| 595 | // The point view takes on the spatial reference of that stage, |
| 596 | // if it had one. |
| 597 | getMetadata().add("spatialreference", |
| 598 | Utils::toString(getSpatialReference())); |
| 599 | } |
| 600 | |
| 601 | MetadataNode node = table.metadata(); |
| 602 | |
| 603 | // serialize metadata |
| 604 | std::string m = pdal::Utils::toJSON(node); |
| 605 | m_array->put_metadata("_pdal", TILEDB_UINT8, m.length() + 1, |
| 606 | m.c_str()); |
| 607 | // add tiledb pointcloud tag |
| 608 | std::string datasetType = "pointcloud"; |
| 609 | m_array->put_metadata("dataset_type", TILEDB_STRING_UTF8, |
| 610 | datasetType.size(), datasetType.data()); |
| 611 | } |
| 612 | m_array->close(); |
| 613 | } |
| 614 | else |
| 615 | { |
| 616 | throwError("Unable to flush points to TileDB array"); |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | bool TileDBWriter::flushCache() |
| 621 | { |
nothing calls this directly
no test coverage detected