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

Method checkReaders

kernels/TileKernel.cpp:118–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116
117
118void TileKernel::checkReaders(const Readers& readers)
119{
120 SpatialReference tempSrs;
121 SpatialReference srs;
122 bool needRepro(false);
123
124 for (auto& rp : readers)
125 {
126 const std::string& filename = rp.first;
127 Streamable *r = rp.second;
128
129 tempSrs = r->getSpatialReference();
130
131 // No SRS
132 if (tempSrs.empty())
133 {
134 if (!m_outSrs.empty())
135 throw pdal_error("Can't reproject file '" + filename +
136 "' with no SRS.");
137 continue;
138 }
139
140 if (srs.empty())
141 srs = tempSrs;
142
143 // Two SRSes
144 if (tempSrs != srs)
145 {
146 if (m_outSrs.empty())
147 {
148 static bool warned(false);
149 if (!warned)
150 {
151 m_log->get(LogLevel::Warning) << "No 'out_srs' specified "
152 "and input files have multiple SRSs. Using SRS of "
153 "first input file as output SRS." << std::endl;
154 warned = true;
155 m_outSrs = srs;
156 }
157 }
158 needRepro = true;
159 }
160 }
161
162 // Non-matching SRS and we requested reprojection
163 if (!m_outSrs.empty() && srs != m_outSrs)
164 needRepro = true;
165
166 if (needRepro)
167 {
168 Options opts;
169 opts.add("out_srs", m_outSrs);
170
171 m_repro = dynamic_cast<Streamable *>(
172 &m_manager.makeFilter("filters.reprojection", opts));
173 }
174}
175

Callers

nothing calls this directly

Calls 4

getSpatialReferenceMethod · 0.80
emptyMethod · 0.45
getMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected