bool NitfWrap::verifyLas(ILeStream& in, BOX3D& bounds, bool& compressed) { LasHeader h; try { in >> h; } catch (pdal_error&) { return false; } compressed = h.compressed(); bounds = h.getBounds(); gdal::reprojectBounds(bounds, h.srs().getWKT(), "EPSG:4326"); return true; }
TEST(LasReaderTest, header) { PointTable table; Options ops; ops.add("filename", Support::datapath("las/simple.las")); LasReader reader; reader.setOptions(ops); reader.prepare(table); // This tests the copy ctor, too. LasHeader h = reader.header(); EXPECT_EQ(h.fileSignature(), "LASF"); EXPECT_EQ(h.fileSourceId(), 0); EXPECT_TRUE(h.projectId().isNull()); EXPECT_EQ(h.versionMajor(), 1); EXPECT_EQ(h.versionMinor(), 2); EXPECT_EQ(h.creationDOY(), 0); EXPECT_EQ(h.creationYear(), 0); EXPECT_EQ(h.vlrOffset(), 227); EXPECT_EQ(h.pointFormat(), 3); EXPECT_EQ(h.pointCount(), 1065u); EXPECT_DOUBLE_EQ(h.scaleX(), .01); EXPECT_DOUBLE_EQ(h.scaleY(), .01); EXPECT_DOUBLE_EQ(h.scaleZ(), .01); EXPECT_DOUBLE_EQ(h.offsetX(), 0); EXPECT_DOUBLE_EQ(h.offsetY(), 0); EXPECT_DOUBLE_EQ(h.offsetZ(), 0); EXPECT_DOUBLE_EQ(h.maxX(), 638982.55); EXPECT_DOUBLE_EQ(h.maxY(), 853535.43); EXPECT_DOUBLE_EQ(h.maxZ(), 586.38); EXPECT_DOUBLE_EQ(h.minX(), 635619.85); EXPECT_DOUBLE_EQ(h.minY(), 848899.70); EXPECT_DOUBLE_EQ(h.minZ(), 406.59); EXPECT_EQ(h.compressed(), false); EXPECT_EQ(h.compressionInfo(), ""); EXPECT_EQ(h.pointCountByReturn(0), 925u); EXPECT_EQ(h.pointCountByReturn(1), 114u); EXPECT_EQ(h.pointCountByReturn(2), 21u); EXPECT_EQ(h.pointCountByReturn(3), 5u); EXPECT_EQ(h.pointCountByReturn(4), 0u); }