X-GIS

Get started

Quickstart.

A working country-fill map in four steps. ~5 minutes start to finish — no shaders, no buffer layouts, no projection math.

1. Install

Two workspace packages. The compiler turns .xgis source into IR + WGSL; the runtime mounts on a <canvas> and renders.

Terminal window
bun add @xgis/compiler @xgis/runtime
# or npm / pnpm / yarn — works the same

Note

WebGPU is required. The runtime falls back to a Canvas 2D renderer when no adapter is available, but only the basic GeoJSON path runs there — no PMTiles, no extruded buildings.

2. Declare a data source

A source block points at the data. Three fields — type, url, and an optional layers filter — cover GeoJSON, PMTiles, TileJSON, and raster XYZ.

map.xgis
source world {
type: geojson
url: "data/ne_110m_countries.geojson"
}

Want the full menu of source kinds? See Source types.

3. Style a layer

A layer references a source by name and stacks Tailwind-style utilities on a | line. Multiple | blocks compose; later utilities win on conflict.

map.xgis (continued)
layer countries {
source: world
| fill-stone-200 stroke-stone-400 stroke-1
}

Every utility is documented in the utility catalog; expressions and operators in Expressions.

4. Mount on a canvas

Two-line JS — new XGISMap(canvas) then map.run(source, baseUrl). The compiler runs in the browser; the runtime owns the WebGPU context.

main.js
import { XGISMap } from '@xgis/runtime'
import source from './map.xgis?raw'
const canvas = document.getElementById('map')
const map = new XGISMap(canvas)
await map.run(source, '/')

For a custom-element flavour (<x-gis-map src="…">), see the JavaScript API.

Next steps

That's the whole loop. From here:

Was this page helpful?

Tell us what's missing