diff --git a/src/h3lib/include/polyfill.h b/src/h3lib/include/polyfill.h index a9110ebf2..3dbb11dd4 100644 --- a/src/h3lib/include/polyfill.h +++ b/src/h3lib/include/polyfill.h @@ -80,7 +80,7 @@ H3Error H3_EXPORT(polygonToCells2)(const GeoPolygon *polygon, int res, uint32_t flags, H3Index *out); -H3Error H3_EXPORT(polygonToCells3)(const GeoPolygon *polygon, +H3Error H3_EXPORT(polygonToCellsCompact)(const GeoPolygon *polygon, int res, uint32_t flags, H3Index *out); diff --git a/src/h3lib/lib/polyfill.c b/src/h3lib/lib/polyfill.c index 93085b4f7..1745fdfd3 100644 --- a/src/h3lib/lib/polyfill.c +++ b/src/h3lib/lib/polyfill.c @@ -406,4 +406,17 @@ H3Error H3_EXPORT(polygonToCells2)(const GeoPolygon *polygon, int res, out[i++] = iter.cell; } return iter.error; +} + +/** + * Compact implementation for polygonToCells + */ +H3Error H3_EXPORT(polygonToCellsCompact)(const GeoPolygon *polygon, int res, + uint32_t flags, H3Index *out) { + IterCellsPolygonCompact iter = iterInitPolygonCompact(polygon, res, flags); + int64_t i = 0; + for (; iter.cell; iterStepPolygonCompact(&iter)) { + out[i++] = iter.cell; + } + return iter.error; } \ No newline at end of file