isosweep Evaluate
For occasional contouring in GIS, GDAL's gdal_contour is the free standard; for plots in Python, matplotlib's contour() (ContourPy underneath); in visualization pipelines, VTK. When contouring is large, recurring or latency-sensitive, or you need closed hill/hole-classified rings and OGC-valid filled contours from an embeddable C or Python library, isosweep is a commercial engine built for that. Compare them on output type, topology, cost with many levels, threading, NoData handling and licence.

What actually differs between contouring libraries

Every library finds where a grid crosses your levels. They differ in what they hand back and what that costs:

  • Output type. Loose two-point segments, assembled polylines, closed rings, or filled polygons (bands between levels, or regions above a level). Turning segments into polygons with holes is a separate, often expensive, pass.
  • Topology. Whether closed contours say which side is higher (a summit or a depression), and whether rings come with their nesting. Labelling, filling and containment queries need this.
  • Cost with many levels. Marching-squares tools scan the whole grid once per level, so 100 levels cost about 100 scans. A sweep that finds all levels in one pass does not pay per level.
  • Threads, memory and NoData. Whether one call can use several cores, whether a raster larger than RAM can be contoured without tiling, and how voids are handled.
  • Interface and licence. C, C++, Python, Rust, JavaScript or a command line; open source or commercial.

The main options

Library Interface Output Notes
GDAL contour (gdal_contour, GDALContourGenerate) C/C++, CLI, Python lines, or polygons with -p Open source; the engine behind QGIS and PostGIS ST_Contour. One thread per call.
ContourPy (and matplotlib contour()) Python (C++ core) lines and filled contours Open source; matplotlib’s engine. Serial and threaded modes.
scikit-image find_contours Python lines, one level per call Open source; part of an image-processing toolkit.
VTK (vtkFlyingEdges2D, vtkContourFilter) C++, Python lines (polylines via vtkStripper) Open source; visualization pipelines, multi-threaded.
contour-rs Rust isolines and filled bands Open source; a port of d3-contour.
d3-contour JavaScript filled regions z ≥ level Open source; browser-side maps and charts.
isosweep C, Python, CLI lines, classified closed rings with nesting, filled bands and per-level polygons (OGC-valid) Commercial; all levels in one pass, multi-threaded, streaming for rasters larger than RAM.

How to choose

  • An occasional contour layer in a GIS: gdal_contour or QGIS. They are free and read every raster format.
  • A plot in a notebook: matplotlib’s contour() / contourf().
  • Inside a VTK or ParaView pipeline: VTK’s filters.
  • In the browser: d3-contour, or a library that ports it.
  • Large, recurring or latency-sensitive contouring (national mapping, LiDAR deliverables, weather-model post-processing every cycle, on-demand contour tiles, interactive re-contouring), many levels on big grids, or closed hill/hole-classified rings and OGC-valid filled contours from an embeddable library: that is the job isosweep is built for. The measured head-to-heads against GDAL, VTK, ContourPy and scikit-image, on the same data, are on the benchmarks page, per use case.

Whichever you pick, test it on your own data at your own levels: the number of levels, the grid size and how much of the grid is quiet change the ranking more than anything else. isosweep’s evaluation includes the benchmark harness for exactly that.

← All explainers