@cereusdb/standard
v0.1.0
Published
Standard CereusDB browser package with GEOS and PROJ support
Downloads
103
Maintainers
Readme
@cereusdb/standard
Standard CereusDB browser package. Everything in @cereusdb/minimal, plus PROJ-backed ST_Transform and CRS-aware reprojection support.
Install
npm install @cereusdb/standardSQL function availability
Current runtime surface:
131runtimeST_*names0runtimeRS_*names
Included function families:
- Everything from
@cereusdb/minimal: core SedonaDB functions,geofunctions, GEOS predicates/operations, relation joins, distance joins, andST_KNN. - PROJ-backed CRS transformation with
ST_Transform.
Examples of available functions:
- Core and
geo:ST_Point,ST_GeomFromWKT,ST_AsText,ST_SRID,ST_Buffer,ST_Distance,ST_DWithin,ST_AsGeoJSON - GEOS:
ST_Contains,ST_Within,ST_Crosses,ST_Touches,ST_Union,ST_Difference,ST_MakeValid,ST_Polygonize - PROJ:
ST_Transform
Not included in this package:
- S2 geography kernels
- Raster
RS_*functions
JS / TS API
Exports:
CereusDBCereusDBOptionsRasterFormatQueryResult
Main types:
type RasterFormat = 'geotiff' | 'tiff';
interface CereusDBOptions {
wasmUrl?: string;
wasmSource?:
| RequestInfo
| URL
| Response
| BufferSource
| WebAssembly.Module
| Promise<Response>;
}Main API:
class CereusDB {
static create(options?: CereusDBOptions): Promise<CereusDB>;
sql(query: string): Promise<Uint8Array>;
sqlJSON(query: string): Promise<Record<string, unknown>[]>;
registerRemoteParquet(name: string, url: string): Promise<void>;
registerFile(name: string, file: File): Promise<void>;
registerGeoJSON(name: string, geojson: string | object): void;
registerRaster(name: string, data: BufferSource, format: RasterFormat): void;
registerGeoTIFF(name: string, data: BufferSource): void;
dropTable(name: string): void;
tables(): string[];
version(): string;
}API notes:
sql()returns Arrow IPC bytes asUint8Array.sqlJSON()returns parsed JSON rows.registerFile()supports.parquet,.geoparquet,.geojson, and.jsonin this package.registerRaster()andregisterGeoTIFF()are part of the shared wrapper, but raster registration requires@cereusdb/full.
Example
import { CereusDB } from '@cereusdb/standard';
const db = await CereusDB.create();
const rows = await db.sqlJSON(`
SELECT ST_AsText(
ST_Transform(
ST_GeomFromWKT('POINT(13.4 52.5)'),
'EPSG:4326',
'EPSG:3857'
)
) AS geom
`);
console.log(rows);