Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
"main": "dist/geoblaze.node.min.js",
"browser": "./dist/geoblaze.web.min.js",
"unpkg": "./dist/geoblaze.web.min.js",
"types": "dist/geoblaze.d.ts",
"scripts": {
"analyze": "webpack --config webpack.analyze.js",
"build": "npm run build:dev && npm run build:prod",
"build": "npm run build:dev && npm run build:prod && npm run build:types",
"build:dev": "npm run build:dev:node && npm run build:dev:web",
"build:dev:node": "webpack --mode development --target node",
"build:dev:web": "webpack --mode development --target web",
"build:prod": "npm run build:prod:node && npm run build:prod:web",
"build:prod:node": "webpack --mode production --target node",
"build:prod:web": "webpack --mode production --target web",
"build:types": "cp src/geoblaze.d.ts dist/geoblaze.d.ts",
"dev": "webpack --mode development --target node --watch",
"documentation": "./node_modules/.bin/documentation build src/** --config documentation.yml -f html -o docs && echo 'geoblaze.io' > docs/CNAME",
"fix": "eslint src --fix",
Expand Down Expand Up @@ -48,6 +50,7 @@
"homepage": "https://github.com/GeoTIFF/geoblaze#readme",
"dependencies": {
"@turf/combine": "^4.7.3",
"@types/geojson": "^7946.0.7",
"georaster": "^1.0.3",
"get-depth": "0.0.0",
"mathjs": "^6.6.1",
Expand Down
94 changes: 94 additions & 0 deletions src/geoblaze.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import { Point, Polygon, Feature, BBox } from "geojson";

declare module 'geoblaze' {
export declare type GeoblazeBBox = {
xmin: number;
xmax: number;
ymin: number;
ymax: number;
};

export interface HistogramOptions {
scaleType: "nominal" | "ratio";
numClasses: number;
classType: "equal-interval" | "quantile";
}

export interface Histogram {
[binKey: string]: number[];
}

export class GeoRaster {
constructor(
data: object | string | Buffer | ArrayBuffer | number[][],
metadata: any,
debug: any
);
}

export type InputPolygon = number[][][] | Polygon | Feature<Polygon>;
export type InputPoint = number[] | Point | Feature<Point>;
export type InputBBox = BBox | GeoblazeBBox;

export function bandArithmetic(
raster: GeoRaster,
operation: string
): Promise<GeoRaster>;

export function get(
raster: GeoRaster,
geom: InputBBox | null | undefined,
flat: boolean
): Promise<GeoRaster>;

// Done
export function histogram(
raster: GeoRaster,
geom: string | InputPolygon | null | undefined,
options: HistogramOptions
): Histogram[];

export function identify(
raster: GeoRaster,
geom?: string | InputPoint | null
): unknown[];

export function load(urlOrFile: object | string): Promise<GeoRaster>;

export function max(
raster: GeoRaster,
geom: string | InputPolygon | null
): Promise<GeoRaster>;

export function mean(
raster: GeoRaster,
geom: string | InputPolygon | null
): Promise<GeoRaster>;

export function median(
raster: GeoRaster,
geom: string | InputPolygon | null
): Promise<GeoRaster>;

export function min(
raster: GeoRaster,
geom: string | InputPolygon | null
): Promise<GeoRaster>;

export function mode(
raster: GeoRaster,
geom: string | InputPolygon | null
): Promise<GeoRaster>;

export function rasterCalculator(
raster: GeoRaster,
operation: string
): GeoRaster;

export function sum(
raster: GeoRaster,
geom: string | InputPolygon | null,
test?: (cellValue: unknown) => boolean,
debug?: boolean
): Promise<Array<unknown>>;
}