@urban-toolkit/autk-core
v2.2.0
Published
Shared runtime utilities for the Autark toolkit
Keywords
Readme
Autark toolkit
Autark is a serverless, modular TypeScript toolkit for prototyping urban visual analytics systems entirely in the browser. It supports client-side workflows for loading, storing, querying, joining, computing, and visualizing physical and thematic urban data using standard formats such as OpenStreetMap, GeoJSON, GeoTIFF, and CSV.
The toolkit is available as the umbrella package @urban-toolkit/autk or as individual modules:
@urban-toolkit/autk-core: Shared low-level core package.@urban-toolkit/autk-db: In-browser spatial database for urban datasets.@urban-toolkit/autk-compute: WebGPU computation engine for analytical and render-based pipelines.@urban-toolkit/autk-map: WebGPU-based 2D/3D vector map visualization library.@urban-toolkit/autk-plot: D3.js-based plotting library for linked urban data views.
@urban-toolkit/autk-core
@urban-toolkit/autk-core contains the shared low-level building blocks used by the other Autark packages. It is useful when you want direct access to color mapping helpers, camera primitives, triangulators, event utilities, or shared type definitions without going through the higher-level map, compute, db, or plot packages.
Use the higher-level packages when possible:
- use
@urban-toolkit/autk-mapfor map rendering and interaction - use
@urban-toolkit/autk-dbfor data loading and spatial queries - use
@urban-toolkit/autk-computefor GPU compute and render-analysis workflows - use
@urban-toolkit/autk-plotfor charts and linked plot interactions
Use @urban-toolkit/autk-core directly when you specifically need shared low-level primitives.
Installation
npm install @urban-toolkit/autk-coreBasic usage
import {
Camera,
ColorMap,
ColorMapDomainStrategy,
ColorMapInterpolator,
TriangulatorPolygons,
computeOrigin,
} from '@urban-toolkit/autk-core';
const origin = computeOrigin(buildingsGeojson);
const [geometry, components] = TriangulatorPolygons.buildMesh(buildingsGeojson, origin);
const camera = new Camera();
const colormap = ColorMap.getColorMap(
ColorMapInterpolator.SEQ_VIRIDIS,
16,
[0, 100],
);
console.log(origin, geometry.length, components.length, camera.eye, colormap.length);API summary
@urban-toolkit/autk-core groups its exports around a few responsibilities:
- Color mapping:
ColorMap,ColorMapDomainStrategy,ColorMapInterpolator,ColorMapConfig,ResolvedDomain - Transfer functions:
DEFAULT_TRANSFER_FUNCTION,buildTransferContext,computeAlphaByte - Camera utilities:
Camera,CameraMotion,CameraData,ViewProjectionParams - Events:
EventEmitter,EventListener,SelectionData - Mesh types:
LayerGeometry,LayerComponent,LayerBorder,LayerBorderComponent - Layer and buffer types:
LayerType,BoundingBox,TypedArray,TypedArrayConstructor - Utilities:
valueAtPath,isNumericLike,computeOrigin,computeGeometryCentroid,computeBoundingBox,isLayerType,mapGeometryTypeToLayerType,offsetPolyline - Triangulators:
TriangulatorPoints,TriangulatorPolylines,TriangulatorPolygons,TriangulatorBuildings,TriangulatorBuildingWithWindows,TriangulatorRaster
The complete export list lives in src/index.ts.
Notes
- Geometry helpers assume planar coordinates unless a function states otherwise.
- Triangulators convert GeoJSON and related feature data into render-ready mesh buffers.
@urban-toolkit/autk-coreis a stable shared dependency of the other Autark packages, but it exposes lower-level APIs than the higher-level modules.
