Basic Zonal Statistics

histogram

The histogram function takes a raster as an input and an optional geometry. If a geometry is included, the function returns the histogram of all the pixels in that area. If no geometry is included, the pixels returns the histogram of all the pixels for each band in the raster.

histogram
Parameters
a (Object) georaster from georaster library
input (Object = undefined) a geometry, which we'll use for clipping result
Returns
Object: array of histograms for each band
Example
var histograms = geoblaze.histogram(georaster, geometry);

identify

Given a raster and a point geometry, the identify function returns the pixel value of the raster at the given point.

identify(georaster: any, geometry: (string | object), raster: object)
Parameters
georaster (any)
geometry ((string | object)) geometry can be an [ x,y ] array, a GeoJSON point object, or a string representation of a GeoJSON point object.
raster (object) a raster from the georaster library

max

The max function takes a raster as an input and an optional geometry. If a geometry is included, the function returns the max of all the pixels in that area. If no geometry is included, the pixels returns the max of all the pixels for each band in the raster.

max
Parameters
a (Object) georaster from georaster library
input (Object = undefined) a geometry, which we'll use for clipping result
Returns
Object: array of maxs for each band
Example
var maxs = geoblaze.max(georaster, geometry);

median

The median function takes a raster as an input and an optional geometry. If a geometry is included, the function returns the median of all the pixels in that area. If no geometry is included, the pixels returns the median of all the pixels for each band in the raster.

median
Parameters
a (Object) georaster from georaster library
input (Object = undefined) a geometry, which we'll use for clipping result
Returns
Object: array of medians for each band
Example
var medians = geoblaze.median(georaster, geometry);

mode

The mode function takes a raster as an input and an optional geometry. If a geometry is included, the function returns the mode of all the pixels in that area. If no geometry is included, the pixels returns the mode of all the pixels for each band in the raster.

mode
Parameters
a (Object) georaster from georaster library
input (Object = undefined) a geometry, which we'll use for clipping result
Returns
Object: array of modes for each band
Example
var modes = geoblaze.mode(georaster, geometry);

min

The min function takes a raster as an input and an optional geometry. If a geometry is included, the function returns the min of all the pixels in that area for each band. If no geometry is included, the pixels returns the min of all the pixels for each band in the raster.

min
Parameters
a (Object) georaster from georaster library
input (Object = undefined) a geometry, which we'll use for clipping result
Returns
Object: array of mins for each band
Example
var mins = geoblaze.min(georaster, geometry);

sum

The sum function takes a raster as an input and an optional geometry. If a geometry is included, the function returns the sum of all the pixels in that area. If no geometry is included, the pixels returns the sum of all the pixels for each band in the raster.

sum
Parameters
a (Object) georaster from georaster library
input (Object = undefined) a geometry, which we'll use for clipping result
Returns
Object: array of sums for each band
Example
var sums = geoblaze.sum(georaster, geometry);

Utils

categorize_intersection

This function categorizes an intersection

categorize_intersection
Parameters
edges (Object)

couple

This function takes in an array with an even number of elements and returns an array that couples every two consecutive elements;

couple
Parameters
array (Object) of anything
Returns
Object: array of consecutive pairs
Example
let items = [0, 1, 18, 77, 99, 103];
let unflattened = utils.couple(items);
// unflattened
// [ [0, 1], [18, 77], [99, 103] ]

merge_ranges

This function takes in an array of number pairs and combines where there's overlap

merge_ranges(ranges: any, array: Object): Object
Parameters
ranges (any)
array (Object) of anything
Returns
Object: array of index ranges
Example
let ranges = [ [0, 10], [10, 10], [20, 30], [30, 40] ];
let merged_ranges = utils.merge_ranges(ranges);
// merged_ranges
// [ [0, 10], [20, 40] ]