Skip to content

Quickstart: command line

isosweep-contour contours any GDAL-readable raster straight to a vector file: contour lines, filled bands or per-level polygons. Rasters that fit its memory budget (default: a quarter of RAM) are read in one call and contoured in memory on all cores. Larger ones are streamed: blocks of rows are read on a separate thread while the previous block is contoured, and the raster is never held whole, so a raster larger than RAM still works. Lines are written as each contour completes; memory is bounded by the raster’s width, not its height. Both paths give the same output.

Terminal window
# every 20 m, GeoPackage out
isosweep-contour --interval 20 dem.tif -o contours.gpkg
# explicit levels, GeoJSON out
isosweep-contour --levels 500,1000,1500,2000 dem.tif -o contours.geojson
Terminal window
# filled contour polygons between consecutive levels (like gdal_contour -p)
isosweep-contour -p --interval 20 dem.tif -o bands.gpkg

Each contour is a LineString with three attributes:

Attribute Meaning
level the contour value
open 1 if the line leaves the raster edge or a NoData region
hill 1 if higher values lie inside a closed contour (a summit), 0 for a depression
Option
-o, --output FILE .gpkg (GeoPackage) or .geojson / .json
-l, --levels L1,L2,… comma-separated contour values
-i, --interval N levels every N across the band’s range
-b, --band N raster band (default 1)
-p, --polygons filled bands between consecutive levels, one MultiPolygon per band with elev_min / elev_max
--level-polygons the regions z ≥ level, one MultiPolygon per level
-t, --threads N threads (default: all cores)
--max-resident-mb N memory budget for reading the raster whole; larger rasters are streamed
--stream stream whatever the raster’s size
--window-rows N streaming: rows per strip (default 256)
--profile print read / contour / write time on stderr
--max-inflight N streaming: cap what contours still open may hold; a contour running the raster’s full height then stops the run cleanly instead of growing memory
-q, --quiet no progress output

NoData and NaN cells cut contours cleanly at the void edge (polygons get holes there), and rotated geotransforms are honoured. Polygons are OGC-valid: exteriors counter-clockwise, holes clockwise. The exit status is non-zero if the output is incomplete. The CLI ships in the evaluation and licence bundles for Linux and macOS (other platforms on request).

Most of a file-to-file run is spent reading the raster and writing the output, not contouring. Use --profile to see the split. Engine benchmarks against GDAL are on contour lines from DEMs.