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

Method processOne

filters/H3Filter.cpp:96–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96bool H3Filter::processOne(PointRef& point)
97{
98
99
100
101 double x(point.getFieldAs<double>(Dimension::Id::X));
102 double y(point.getFieldAs<double>(Dimension::Id::Y));
103 double z(0.0);
104
105 LatLng ll;
106 H3Index index(0);
107 bool ok = m_transform->transform(x, y, z);
108 if (ok)
109 {
110 // x is longitude
111 double xrad = PDALH3degsToRads(x);
112 double yrad = PDALH3degsToRads(y);
113 ll.lat = yrad;
114 ll.lng = xrad;
115
116 H3Error err = PDALH3latLngToCell(&ll, m_args->m_resolution, &index);
117 if (err == E_SUCCESS)
118 {
119 point.setField(Dimension::Id::H3, index);
120 } else
121 {
122 throwError("Unable to compute H3 cell id for point!");
123 }
124 }
125 else
126 throwError("Couldn't reproject point with X/Y/Z coordinates of (" +
127 std::to_string(point.getFieldAs<double>(Dimension::Id::X)) + ", " +
128 std::to_string(point.getFieldAs<double>(Dimension::Id::Y)) + ").");
129 return ok;
130}
131
132void H3Filter::spatialReferenceChanged(const SpatialReference& srs)
133{

Callers

nothing calls this directly

Calls 2

transformMethod · 0.45
setFieldMethod · 0.45

Tested by

no test coverage detected