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

Method initialize

io/private/ept/EptInfo.cpp:73–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73void EptInfo::initialize()
74{
75 m_bounds = toBox3d(m_info.at("bounds"));
76 m_boundsConforming = toBox3d(m_info.at("boundsConforming"));
77 m_points = m_info.value<uint64_t>("points", 0);
78 m_span = m_info.at("span").get<uint64_t>();
79 m_version = m_info.at("version").get<std::string>();
80
81 auto iSrs = m_info.find("srs");
82 if (iSrs != m_info.end() && iSrs->size())
83 {
84 std::string wkt;
85 auto iWkt = iSrs->find("wkt");
86 auto iAuthority = iSrs->find("authority");
87 auto iHorizontal = iSrs->find("horizontal");
88 auto iVertical = iSrs->find("vertical");
89
90 if (iWkt != iSrs->end())
91 {
92 if (!iWkt->is_string())
93 throw pdal_error("srs.wkt must be specified as a string. "
94 "Found '" + iWkt->dump() + "'.");
95 wkt = iWkt->get<std::string>();
96 }
97 else
98 {
99 if (iAuthority == iSrs->end() || iHorizontal == iSrs->end())
100 throw pdal_error("srs must be defined with at least one of "
101 "wkt or both authority and horizontal specifications.");
102 if (!iAuthority->is_string())
103 throw pdal_error("srs.authority must be specified as a "
104 "string. Found '" + iAuthority->dump() + "'.");
105 wkt = iAuthority->get<std::string>();
106
107 std::string horiz;
108 if (iHorizontal->is_number_unsigned())
109 horiz = std::to_string(iHorizontal->get<uint64_t>());
110 else if (iHorizontal->is_string())
111 horiz = iHorizontal->get<std::string>();
112 else
113 throw pdal_error("srs.horizontal must be specified as a "
114 "non-negative integer or equivalent string. "
115 "Found '" + iHorizontal->dump() + "'.");
116 wkt += ":" + horiz;
117
118 if (iVertical != iSrs->end())
119 {
120 std::string vert;
121 if (iVertical->is_number_unsigned())
122 vert = std::to_string(iVertical->get<uint64_t>());
123 else if (iVertical->is_string())
124 vert = iVertical->get<std::string>();
125 else
126 throw pdal_error("srs.vertical must be specified as a "
127 "non-negative integer or equivalent string. "
128 "Found '" + iVertical->dump() + "'.");
129 wkt += "+" + vert;
130 }

Callers

nothing calls this directly

Calls 15

toBox3dFunction · 0.85
DimTypeClass · 0.85
fixNameFunction · 0.85
iequalsFunction · 0.85
atMethod · 0.80
registerDimMethod · 0.80
typeFunction · 0.50
findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected