Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add iteration utilities for iterating over native arrays (#111)
This PR adds minimal STL iterators that can be used to iterate over GeoArrow memory. The idea is to allow forward iteration from C++ (as opposed to visitor-style iteration from C or C++). An example from the tests: ```c geoarrow::ArrayReader reader(type); reader.SetArray(&array); geoarrow::array::MultiPolygonArray<XY> native_array; ASSERT_EQ(native_array.Init(reader.View().array_view()), GEOARROW_OK); std::vector<std::vector<std::vector<std::vector<XY>>>> multipolygons; for (const auto& multipolygon : native_array.value) { std::vector<std::vector<std::vector<XY>>> polygons; for (const auto& polygon : multipolygon) { std::vector<std::vector<XY>> rings; for (const auto& ring : polygon) { std::vector<XY> coords; for (const auto& coord : ring) { coords.push_back(coord); } rings.push_back(std::move(coords)); } polygons.push_back(std::move(rings)); } multipolygons.push_back(std::move(polygons)); } ``` I think the iterators need a few more overloads to be truly random access iterators, but the idea is there and they can be improved with time. All of these are currently "just structs" intended for very low-level iteration (not necessary a pretty user-facing interface).
- Loading branch information