diff --git a/filters/private/hexer/BaseGrid.hpp b/filters/private/hexer/BaseGrid.hpp index 556dd954da..2bac9a1998 100644 --- a/filters/private/hexer/BaseGrid.hpp +++ b/filters/private/hexer/BaseGrid.hpp @@ -51,7 +51,7 @@ class PDAL_DLL BaseGrid // returns a single point from a segment to be used as the vertex of a hexagon virtual Point findPoint(Segment& s) = 0; virtual bool sampling() const = 0; - virtual uint64_t getID(int& n, const HexId& ij) = 0; + virtual uint64_t getID(HexId ij) = 0; virtual double height() = 0; virtual H3Index ij2h3(HexId ij) diff --git a/filters/private/hexer/H3grid.hpp b/filters/private/hexer/H3grid.hpp index 3944b0aa03..79fcc7d64a 100644 --- a/filters/private/hexer/H3grid.hpp +++ b/filters/private/hexer/H3grid.hpp @@ -73,7 +73,7 @@ class PDAL_DLL H3Grid : public BaseGrid } bool sampling() const { return m_res < 0; } - uint64_t getID(int& n, const HexId& ij) + uint64_t getID(HexId ij) { return ij2h3(ij); } // test function: used when inserting pre-defined grids in tests, diff --git a/filters/private/hexer/HexGrid.hpp b/filters/private/hexer/HexGrid.hpp index 8243661bdb..9bff30caf2 100644 --- a/filters/private/hexer/HexGrid.hpp +++ b/filters/private/hexer/HexGrid.hpp @@ -28,8 +28,8 @@ class PDAL_DLL HexGrid : public BaseGrid { return m_height; } bool sampling() const { return m_width < 0; } - uint64_t getID(int& n, const HexId& ij) - { return n; } + uint64_t getID(HexId ij) + { return (((uint64_t)ij.i << 32) | (uint64_t)ij.j); } Point findPoint(Segment& s); private: diff --git a/kernels/private/density/OGR.cpp b/kernels/private/density/OGR.cpp index 1311d65c09..7fbecf2841 100644 --- a/kernels/private/density/OGR.cpp +++ b/kernels/private/density/OGR.cpp @@ -208,7 +208,6 @@ void OGR::writeBoundary(hexer::BaseGrid& grid) void OGR::writeDensity(hexer::BaseGrid& grid) { - int counter(0); for (auto& [coord, count] : grid.getHexes()) { if (grid.isDense(coord)) { @@ -216,8 +215,8 @@ void OGR::writeDensity(hexer::BaseGrid& grid) OGRFeatureH hFeature; hFeature = OGR_F_Create(OGR_L_GetLayerDefn(m_layer)); - OGR_F_SetFieldInteger( hFeature, OGR_F_GetFieldIndex(hFeature, "ID"), - grid.getID(counter, coord)); + OGR_F_SetFieldInteger64( hFeature, OGR_F_GetFieldIndex(hFeature, "ID"), + grid.getID(coord)); OGR_F_SetFieldInteger( hFeature, OGR_F_GetFieldIndex(hFeature, "COUNT"), count); @@ -232,7 +231,6 @@ void OGR::writeDensity(hexer::BaseGrid& grid) throw pdal::pdal_error(oss.str()); } OGR_F_Destroy( hFeature ); - counter++; } } }