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

Method done

filters/HexBinFilter.cpp:224–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222}
223
224void HexBin::done(PointTableRef table)
225{
226 if (!createGrid())
227 return;
228
229 m_metadata.add("threshold", m_grid->denseLimit(),
230 "Minimum number of points inside a hexagon to be considered full");
231 m_metadata.add("sample_size", m_sampleSize, "Number of samples used for "
232 "estimating hexagon edge size. Only used if 'edge_length' or "
233 "'h3_resolution' is not set.");
234
235 Utils::OStringStreamClassicLocale polygon;
236 polygon.setf(std::ios_base::fixed, std::ios_base::floatfield);
237 polygon.precision(m_precision);
238 m_grid->toWKT(polygon);
239
240 if (m_outputTesselation)
241 {
242 m_metadata.add("hex_boundary", polygon.str(),
243 "Boundary MULTIPOLYGON of domain");
244 }
245
246 // density and boundary writing with OGR does not support polygon smoothing
247 if (m_DensityOutput.size())
248 {
249 OGR writer(m_DensityOutput, m_srs.getWKT(), m_driver, "hexbins");
250 writer.writeDensity(*m_grid);
251 }
252 if (m_boundaryOutput.size())
253 {
254 OGR writer(m_boundaryOutput, m_srs.getWKT(), m_driver, "hexbins");
255 writer.writeBoundary(*m_grid);
256 }
257
258 pdal::Polygon p(polygon.str(), m_srs);
259
260 // If the SRS was geographic, use relevant
261 // UTM for area and density computation
262 Polygon density_p(p);
263 if (m_srs.isGeographic())
264 {
265 // Compute a UTM polygon
266 BOX3D box = p.bounds();
267 int zone = SpatialReference::calculateZone(box.minx, box.miny);
268 if (!density_p.transform(SpatialReference::wgs84FromZone(zone)))
269 density_p = Polygon();
270 }
271
272 double area = density_p.area();
273 double density = m_count / area;
274 if (std::isinf(density))
275 {
276 density = -1.0;
277 area = -1.0;
278 }
279
280 m_metadata.add("density", density,
281 "Number of points per square unit (total area)");

Callers

nothing calls this directly

Calls 15

strMethod · 0.80
getWKTMethod · 0.80
writeDensityMethod · 0.80
writeBoundaryMethod · 0.80
isGeographicMethod · 0.80
areaMethod · 0.80
isDenseMethod · 0.80
simplifyMethod · 0.80
jsonMethod · 0.80
PolygonFunction · 0.50
addMethod · 0.45
precisionMethod · 0.45

Tested by

no test coverage detected