-
Notifications
You must be signed in to change notification settings - Fork 429
/
i3sReaderTest.cpp
142 lines (106 loc) · 4.1 KB
/
i3sReaderTest.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#include <pdal/pdal_test_main.hpp>
#include "Support.hpp"
#include <pdal/PipelineManager.hpp>
#include <pdal/StageFactory.hpp>
#include <pdal/PointView.hpp>
#include <pdal/util/FileUtils.hpp>
#include <io/LasReader.hpp>
#include <io/LasWriter.hpp>
#include "../io/I3SReader.hpp"
#include "../io/SlpkReader.hpp"
using namespace pdal;
//test full autzen lidar i3s with bounds that hold the entire data
//also tests that default depth pulls full resolution of data
TEST(i3sReaderTest, options_test)
{
StageFactory f;
//create args
Options i3s_options;
i3s_options.add("filename", "i3s://https://tiles.arcgis.com/tiles/8cv2FuXuWSfF0nbL/arcgis/rest/services/AUTZEN_LiDAR/SceneServer");
i3s_options.add("threads", 64);
i3s_options.add("dimensions", "RGB, intenSITY");
I3SReader reader;
reader.setOptions(i3s_options);
PointTable table;
reader.prepare(table);
PointViewSet viewSet = reader.execute(table);
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(view->size(), 10653336u);
ASSERT_TRUE(table.layout()->hasDim(Dimension::Id::Red));
ASSERT_TRUE(table.layout()->hasDim(Dimension::Id::Intensity));
ASSERT_FALSE(table.layout()->hasDim(Dimension::Id::NumberOfReturns));
}
TEST(i3sReaderTest, density_test)
{
StageFactory f;
Options i3s_options;
i3s_options.add("filename", "i3s://https://tiles.arcgis.com/tiles/8cv2FuXuWSfF0nbL/arcgis/rest/services/AUTZEN_LiDAR/SceneServer");
i3s_options.add("threads", 64);
i3s_options.add("min_density", 0);
i3s_options.add("max_density", 0.5);
I3SReader reader;
reader.setOptions(i3s_options);
PointTable table;
reader.prepare(table);
PointViewSet viewSet = reader.execute(table);
PointViewPtr view = *viewSet.begin();
//59994 is the number of points in the first depth of the autzen data
EXPECT_EQ(view->size(), 14998u);
}
//Test full autzen lidar i3s bounded compared to the full without bounds.
TEST(i3sReaderTest, bounds_test)
{
//first run
StageFactory f;
//create args
Options i3s_options;
i3s_options.add("filename", "i3s://https://tiles.arcgis.com/tiles/8cv2FuXuWSfF0nbL/arcgis/rest/services/AUTZEN_LiDAR/SceneServer");
i3s_options.add("threads", 64);
i3s_options.add("bounds", "([-123.077,-123.063],[44.053, 44.060], [130, 175])");
i3s_options.add("min_density", 1);
i3s_options.add("max_density", 1.5);
I3SReader reader;
reader.setOptions(i3s_options);
PointTable table;
reader.prepare(table);
PointViewSet viewSet = reader.execute(table);
PointViewPtr view = *viewSet.begin();
BOX3D bounds = reader.createBounds();
//second run
StageFactory f2;
Options options2;
options2.add("filename", "i3s://https://tiles.arcgis.com/tiles/8cv2FuXuWSfF0nbL/arcgis/rest/services/AUTZEN_LiDAR/SceneServer");
options2.add("threads", 64);
options2.add("min_density", 1);
options2.add("max_density", 1.5);
I3SReader reader2;
reader2.setOptions(options2);
PointTable table2;
reader2.prepare(table2);
PointViewSet viewSet2 = reader2.execute(table2);
PointViewPtr view2 = *viewSet2.begin();
//test bounds
double x, y, z;
for(std::size_t i = 0; i < view->size(); i++)
{
x = view->getFieldAs<double>(Dimension::Id::X, i);
y = view->getFieldAs<double>(Dimension::Id::Y, i);
z = view->getFieldAs<double>(Dimension::Id::Z, i);
ASSERT_TRUE(bounds.contains(x,y,z));
}
unsigned int pointcount = 0;
for(std::size_t i = 0; i < view2->size(); i++)
{
x = view2->getFieldAs<double>(Dimension::Id::X, i);
y = view2->getFieldAs<double>(Dimension::Id::Y, i);
z = view2->getFieldAs<double>(Dimension::Id::Z, i);
if(bounds.contains(x,y,z))
pointcount++;
}
EXPECT_EQ(view->size(), pointcount);
//create LoD standard and test against view2 size
std::unique_ptr<arbiter::Arbiter> arbiter;
Json::Value config;
arbiter.reset(new arbiter::Arbiter(config));
std::string url = "https://tiles.arcgis.com/tiles/8cv2FuXuWSfF0nbL/arcgis/rest/services/AUTZEN_LiDAR/SceneServer/layers/0/nodepages/";
}