Computes the contours for the given array of values, returning an array of GeoJSON MultiPolygon geometry objects. Each geometry object represents the area where the input values are greater than or equal to the corresponding threshold value; the threshold value for each geometry object is exposed as geometry.value.
The returned geometry objects are typically passed to d3.geoPath to display, using null or d3.geoIdentity as the associated projection
Array of input values. The input values must be an array of length n×m where [n, m] is the contour generator’s size; furthermore, each values[i + jn] must represent the value at the position ⟨i, j⟩.
Computes a single contour, returning a GeoJSON MultiPolygon geometry object. This geometry object represents the area where the input values are greater than or equal to the given threshold value; the threshold value for the geometry object is exposed as geometry.value.
Array of input values. The input values must be an array of length n×m where [n, m] is the contour generator’s size; furthermore, each values[i + jn] must represent the value at the position ⟨i, j⟩.
Threshold value.
Return the expected size of the input values grid, which defaults to [1,1].
Sets the expected size of the input values grid to the contour generator and returns the contour generator.
Size of the input values grid specified as an array [n, m] where n is the number of columns in the grid and m is the number of rows; n and m must be positive integers.
Returns the current smoothing flag, which defaults to true.
Sets whether or not the generated contour polygons are smoothed using linear interpolation and returns the contour generator.
Flag to enable linear interpolation. The default is "true".
Returns the current threshold generator, which by default implements Sturges’ formula.
Sets the threshold generator to the specified function or array and returns this contour generator. Thresholds are defined as an array of values [x0, x1, …]. The first generated contour corresponds to the area where the input values are greater than or equal to x0; the second contour corresponds to the area where the input values are greater than or equal to x1, and so on. Thus, there is exactly one generated MultiPolygon geometry object for each specified threshold value; the threshold value is exposed as geometry.value. If a count is specified instead of an array of thresholds, then the input values’ extent will be uniformly divided into approximately count bins; see d3.ticks.
A contour generator which computes contour polygons by applying marching squares to a rectangular array of numeric values.
For each threshold value, the contour generator constructs a GeoJSON MultiPolygon geometry object representing the area where the input values are greater than or equal to the threshold value. The geometry is in planar coordinates, where ⟨i + 0.5, j + 0.5⟩ corresponds to element i + jn in the input values array.