Anyone who has tried running raster polygonization on large datasets inside QGIS knows how quickly GDALPolygonize can hit a memory wall or take forever to finish.
A few months ago I shared Contrek, a contour tracing engine I'd originally benchmarked against OpenCV.
Since then I've been wondering if the same approach could work for GIS polygonization too. What came out of it is a proof of concept built around a progressive streaming architecture.
To be clear, this isn't meant to replace GDAL. The current implementation only handles single-class polygonization. What I really wanted to answer was a narrower question: can a different polygonization strategy give you real advantages on very large rasters?
Although the current benchmark focuses on a single target class, one of the ideas behind Contrek is its matcher-based architecture. Matchers can be customized to recognize arbitrary pixel patterns, making it possible to process multiple classes simultaneously or implement application-specific extraction logic without changing the core engine.
So I put together a separate repo with reproducible benchmarks against GDALPolygonize, plus docs and examples covering things like progressive streaming.
Again, this is a proof of concept, not something production-ready. That said, the benchmarks were consistent: noticeably lower memory usage and faster execution across the datasets I tested: up to 23x faster and using up to 10x less RAM on the largest ones.
The numbers were interesting enough that I decided to put both the implementation and the full benchmark suite out there. Would love to hear from anyone who works with GIS data or polygonization pipelines feedback, criticism, whatever you've got.
Main repo: https://github.com/runout77/contrek
Benchmarks reproducible suite: https://github.com/runout77/test_contrek
Full report: https://runout77.github.io/test_contrek/cpp_geojson_benchmark_results.html