Expand description
Constructors§
Accessors§
Methods§
Source§buildHeatmap(params: BuildHeatmapParams): Promise<Table>
buildHeatmap(params: BuildHeatmapParams): Promise<Table>
Builds a heatmap from spatial data by creating a grid and aggregating values. The heatmap is generated by creating a grid over the bounding box and aggregating values from the source table into each grid cell.
Source§getBoundingBoxFromLayer(layerName: string): Promise<BoundingBox>
getBoundingBoxFromLayer(layerName: string): Promise<BoundingBox>
Retrieves the bounding box of a layer by its table name.
Source§getLayer(
layerTableName: string,
): Promise<FeatureCollection<Geometry, GeoJsonProperties>>
getLayer(
layerTableName: string,
): Promise<FeatureCollection<Geometry, GeoJsonProperties>>
Retrieves the GeoJSON representation of a layer by its table name. The returned FeatureCollection will include a bbox property with the layer's bounding box.
Source§getLayerTables(): (LayerTable | CustomLayerTable)[]
getLayerTables(): (LayerTable | CustomLayerTable)[]
Retrieves all layer tables (LayerTable and CustomLayerTable) from the loaded tables.
Source§getOsmBoundingBox(): [number, number, number, number] | null
getOsmBoundingBox(): [number, number, number, number] | null
Retrieves the bounding box of the OSM data loaded from the Overpass API for the current workspace.
Source§getTableData(params: GetTableDataParams): Promise<GetTableDataOutput>
getTableData(params: GetTableDataParams): Promise<GetTableDataOutput>
Retrieves the data from any table as an array of plain JavaScript objects. This method works with all table types (CSV, JSON, Layer, Grid, etc.).
Source§init(): Promise<void>
init(): Promise<void>
Initializes the SpatialDb instance by loading the DuckDB database and setting up use cases.
Source§loadCsv(params: Params): Promise<CsvTable>
loadCsv(params: Params): Promise<CsvTable>
Loads a CSV file into the database and returns the created CsvTable.
Source§loadCustomLayer(params: Params): Promise<CustomLayerTable>
loadCustomLayer(params: Params): Promise<CustomLayerTable>
Loads a custom layer from a GeoJSON file and returns the created CustomLayerTable. If OSM bounding box is available, it will be automatically applied to crop the layer.
Source§loadGridLayer(params: LoadGridLayerParams): Promise<GridLayerTable>
loadGridLayer(params: LoadGridLayerParams): Promise<GridLayerTable>
Loads a grid layer and returns the created GridLayerTable. If no bounding box is provided in params, the OSM bounding box will be used if available.
Source§loadJson(params: Params): Promise<JsonTable>
loadJson(params: Params): Promise<JsonTable>
Loads a JSON file into the database and returns the created JsonTable.
Source§loadLayer(params: Params): Promise<LayerTable>
loadLayer(params: Params): Promise<LayerTable>
Loads a layer from an OSM input table and returns the created LayerTable.
Source§loadOsmFromOverpassApi(params: Params): Promise<void>
loadOsmFromOverpassApi(params: Params): Promise<void>
Loads OSM data from the Overpass API and optionally loads layers based on the provided parameters. When autoLoadLayers is enabled, this method will automatically extract and process specific layers (e.g., buildings, roads, surface) from the OSM data, and optionally polygonize the surface layer.
Source§rawQuery<T = RawQueryOutput>(params: RawQueryParams): Promise<Table | T>
rawQuery<T = RawQueryOutput>(params: RawQueryParams): Promise<Table | T>
Executes a raw SQL query and returns the result.
Source§setWorkspace(name: string): Promise<void>
setWorkspace(name: string): Promise<void>
Sets the current workspace. If the workspace doesn't exist, it will be created.
SpatialDb class provides methods to interact with a DuckDB database for spatial data operations.
It allows loading OSM data, CSV, JSON, custom layers, and grid layers, as well as performing spatial joins and raw queries. It also provides methods to retrieve layer data and bounding boxes.
Supports multiple isolated workspaces, each with its own schema and data.