← API Reference

@mapgpu/core

Core types, MapView, event system, projections, and renderers.

npm install @mapgpu/core

Exports

class MapView

Unified map view with 2D/3D mode switching. Creates a WebGPU canvas, manages layers, handles user interaction, and provides coordinate conversion. This is the main entry point for the library.

class GameMap

Layer container that manages add, remove, reorder, and findById operations. Accessed via MapView.map.

class SimpleRenderer

Applies the same symbol to every feature. Use when all features should look identical.

class UniqueValueRenderer

Assigns symbols based on a feature attribute value. Use for categorical data (e.g. country, type, status).

class ClassBreaksRenderer

Assigns symbols based on numeric ranges. Use for quantitative data (e.g. population, elevation, speed).

class CallbackRenderer

Per-feature dynamic symbol via a callback function. Maximum flexibility — use when other renderers are insufficient.

interface PointSymbol

Symbol definition for point features. Supports simple circle markers, icon images, and SDF icons. Includes optional glow halo and background circle effects.

interface LineSymbol

Symbol definition for line/polyline features. Supports solid, dash, dot, and dash-dot styles with optional animated dashes and glow effects.

interface PolygonSymbol

Symbol definition for polygon features. Supports fill color, outline, and optional glow effect on the outline.

class GlobeProjection

Dual projection that blends Mercator (flat) and Vertical Perspective (globe) based on zoom level. Transition happens at zoom 5-6 with a smooth globeness factor.

class VectorBufferCache

GPU buffer cache for vector features. Builds GPU buffers from Feature[] + Renderer, caches by layer ID and symbol key. Invalidates on data or renderer change.