Calculate the bounding box of the ASCII Grid using fast but imprecise floating-point arithmetic. For a slower, but more precise bounding box calculation, use calcAsciiGridPreciseBoundingBox.
((ArrayBuffer | Buffer | String))
your ASCII grid data
(Number
= 0
)
0 prevents all logging, 1+ logging to help debugging
(Number
= Infinity
)
how much to read of the ASCII grid file
Array<Number>
:
bounding box in numerical format [xmin, ymin, xmax, ymax]
import { calcAsciiGridBoundingBox } from "ascii-grid";
calcAsciiGridBoundingBox({
data: <ArrayBuffer>
});
[491501, 2556440, 594634.0933000001, 2645315.3392]
Calculate the bounding box of the ASCII Grid using preciso a library for precise mathetmical calculations that avoid float-point arithemtic imprecision. This is the more precise (but slower) version of calcAsciiGridBoundingBox.
((ArrayBuffer | Buffer | String))
your ASCII grid data
(Number
= 0
)
0 prevents all logging, 1+ logging to help debugging
(Number
= Infinity
)
how much to read of the ASCII grid file
Array<String>
:
bounding box in numerical string format [xmin, ymin, xmax, ymax]
import { calcAsciiGridPreciseBoundingBox } from "ascii-grid";
calcAsciiGridPreciseBoundingBox({
data: <ArrayBuffer>
});
["491501", "2556440", "594634.0933", "2645315.3392"]
Calculate Statistics for a Given ASCII Grid. Basically runs calc-stats on the data.
(Boolean
= true
)
assume that cell values are valid numbers and don't include null bytes
(Number
= 0
)
0 prevents all logging, 1+ logging to help debugging
((ArrayBuffer | Buffer | String))
your ASCII grid data
(Number
= Infinity
)
how much to read of the ASCII grid file
(Number?)
where the metadata ends and to start reading the cell values
(Number
= 0
)
which column to start reading from. zero is the furthest left column.
(Number?)
at which column to stop reading. defaults to reading to the end of the grid
(Number?)
which row to start reading from. zero is the top/first row.
(Number?)
which row to stop reading from. defaults to reading through the last row.
(Boolean
= true
)
calculate a histogram of cell values
(Boolean
= true
)
calculate the maximum of all the valid cell values
(Boolean
= true
)
calculate the mean of all the valid cell values
(Boolean
= true
)
calculate the median of all the valid cell values
(Boolean
= true
)
calculate the min of all the valid cell values
(Boolean
= true
)
calculate the most common cell value (ignoring no-data values)
(Boolean
= true
)
calculate array of the most common cell values (ignoring no-data values)
(Boolean
= true
)
calculate the sum of all cell values (ignoring no-data values)
CalcStatsResults
:
Results object from running
calc-stats
over the data
count the number of digits right of the decimal point for a given numerical string
(String)
a number as a string
Number
:
the number of digits right of the decimal point
run a callback function on each cell in your ASCII Grid
((ArrayBuffer | Buffer | String))
(Boolean
= true
)
(Boolean
= false
)
(Number
= 0
)
(Number
= Infinity
)
(Number?)
(Number
= 0
)
(Number?)
(Number
= 0
)
(Number?)
(Object?)
import { forEachAsciiGridPoint } from "ascii-grid";
forEachAsciiGridPoint({
data: <ArrayBuffer>,
callback: ({n, c, r }) => {
console.log(`value "${n}" at row "${r}" and column "${c}"`);
}
});
gets the length of your ASCII Grid data. If it's a string, return the string length. If it's a typed array, return the length. If it's binary (e.g. ArrayBuffer and Buffer), return the number of bytes,
(Object)
Name | Description |
---|---|
input.data (ArrayBuffer | Buffer | String)
|
your data |
Type: Object
write ASCII-Grid text file (.asc)